-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show ECE buttons on products w/o shipping tax included in price, and improve tests #9954
base: develop
Are you sure you want to change the base?
Conversation
277749f
to
a84ac6e
Compare
public function test_filter_cart_needs_shipping_address_regular_products() { | ||
$this->assertEquals( | ||
true, | ||
$this->system_under_test->filter_cart_needs_shipping_address( true ), | ||
'Should not modify shipping address requirement for regular products' | ||
); | ||
} | ||
|
||
|
||
public function test_filter_cart_needs_shipping_address_subscription_products() { | ||
WC_Subscriptions_Cart::set_cart_contains_subscription( true ); | ||
$this->mock_ece_button_helper->method( 'is_checkout' )->willReturn( true ); | ||
|
||
$this->zone->delete_shipping_method( $this->flat_rate_id ); | ||
$this->zone->delete_shipping_method( $this->local_pickup_id ); | ||
|
||
$this->assertFalse( | ||
$this->system_under_test->filter_cart_needs_shipping_address( true ), | ||
'Should not require shipping address for subscription without shipping methods' | ||
); | ||
|
||
remove_filter( 'woocommerce_shipping_method_count', '__return_zero' ); | ||
WC_Subscriptions_Cart::set_cart_contains_subscription( false ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are two tests I took from test-class-wc-payments-express-checkout-button-helper.php
and put into this file as these tests serve different purposes - they test WC_Payments_Express_Checkout_Button_Handler
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.39 MB ℹ️ View Unchanged
|
Fixes #9921
Changes proposed in this Pull Request
This PR adds the new part to the conditional responsible for filtering out the ece button based on whether it's not shippable and tax is calculated from billing address, which is not present.
we now check for the option selected under WooCommerce -> Settings -> Tax -> Prices entered with tax. If prices entered are inclusive of tax, we will consider that ECE button can be rendered even if does not have billing address.
This PR also refactors some tests in this area, because they were mocking the class that is under test and included tests for two classes under one test suite.
Testing instructions
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge