-
Notifications
You must be signed in to change notification settings - Fork 219
Remove WC Core shipping settings if Cart/Checkout blocks are in use #8679
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/edit.tsx
assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx assets/js/data/cart/reducers.ts assets/js/utils/attributes.ts |
Size Change: +1.74 kB (0%) Total Size: 1.12 MB
ℹ️ View Unchanged
|
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.
Tested out ok! remove_shipping_settings()
might be a bit too big and confusing with all the iteration going on, but the comments make it easier.
This class will store reusable methods relating to Cart/Checkout Blocks, i.e. whether they are used on the Cart/Checkout page.
This will reduce code duplication when checking if the Cart/Checkout blocks are in use on the Cart/Checkout page.
Required because importing from the index causes the validation data store to register twice
This reverts commit 9967dc0.
63a1ddb
to
54833ea
Compare
Mentioning that a part of this PR was merged https://github.com/woocommerce/woocommerce-blocks/commit/510eec49f3f841bf61c531bf4460efe9a384f3c3#diff-a942a5198733d5fa79[…]34694286a6e49e4R420-R427 in the WC Blocks 9.8.0 release branch via this PR #8718. See the internal discussion p1678712946221229-slack-C8X6Q7XQU. If this PR gets reverted at some point, the bug fix mentioned above should be brought to trunk. |
This is part of a series of PRs required to satisfy #7895.
In this PR we remove settings from
WooCommerce -> Settings -> Shipping -> Shipping Options
Specifically the options disabled are:
Enable the shipping calculator on the cart page
if the Cart Block is present on the Cart page and,Hide shipping costs until an address is entered
if the Checkout Block is present on the Checkout page.The first setting is controlled by the Cart Block's settings, and the second option should always be
no
for the purposes of getting the correct local pickup rates from the store API, and will be moved to a block setting in a later PR.I also added a utility function to see if the Cart/Checkout blocks are the default experience. This check could be made multiple places over the codebase, so when we spot it we can update it to use the utility function.
It also adds E2E tests to ensure this is working as expected.
Screenshots
Testing
Automated Tests
User Facing Testing
WooCommerce -> Settings -> Advanced
- set the Cart and Checkout pages to pages containing the shortcode cart/checkout experience. Save.WooCommerce -> Settings -> Shipping -> Shipping Options
- observe the two options,Hide shipping costs until an address is entered
andEnable the shipping calculator on the cart page
.WooCommerce -> Settings -> Advanced
- set the Cart page to one containing the Cart Block. Save.WooCommerce -> Settings -> Shipping -> Shipping Options
- observe that where the two options were in step 2, only,Hide shipping costs until an address is entered
remains. Ensure it displays correctly and looks OK.WooCommerce -> Settings -> Advanced
- set the Checkout page to one containing the Checkout Block. Save.WooCommerce -> Settings -> Shipping -> Shipping Options
- observe that where the two options were in step 2 nothing appears.WooCommerce -> Settings -> Advanced
- set the Cart page to one containing the Shortcode cart. Save.WooCommerce -> Settings -> Shipping -> Shipping Options
- observe that where the two options were in step 2 onlyEnable the shipping calculator on the cart page
appears. Ensure it displays correctly.Expected results
WooCommerce Visibility
Performance Impact
Changelog