Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Introduce Local Pickup to Checkout #7433

Merged
merged 44 commits into from
Jan 13, 2023
Merged

Conversation

mikejolley
Copy link
Member

@mikejolley mikejolley commented Oct 19, 2022

This is the feature branch that contains the Local Pickup work, code has existed in PRs and those were all merged into this one.

Local Pickup refers to the work to:

  • Introduce a new shipping method toggle bloc that allows people to select between regular home shipping or picking up an order from a location.
  • A Pickup location block that shows local pickup rates only.
  • Introduction of a new shipping method called pickup_location, which is different from local_pickup in a sense that it doesn't rely on shipping zones.
  • A new local pickup setting page that manages the new shipping method above.
  • Decoupling shipping and requiring an address from local pickup at form level.

closes #7136
closes #7161
closes #7163
closes #7164

Screenshots

image

image

image

image

User Facing Testing

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • [] Experimental

Changelog

Add Local Pickup shipping method and its blocks.

@mikejolley mikejolley added type: enhancement The issue is a request for an enhancement. block: checkout Issues related to the checkout block. labels Oct 19, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2022

This PR has been marked as stale because it has not seen any activity within the past 7 days. Our team uses this tool to help surface pull requests that have slipped through review.

If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label.

@github-actions github-actions bot added the status: stale Stale issues and PRs have had no updates for 60 days. label Nov 2, 2022
@github-actions github-actions bot removed the status: stale Stale issues and PRs have had no updates for 60 days. label Nov 12, 2022
@github-actions
Copy link
Contributor

This PR has been marked as stale because it has not seen any activity within the past 7 days. Our team uses this tool to help surface pull requests that have slipped through review.

If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label.

@github-actions github-actions bot added the status: stale Stale issues and PRs have had no updates for 60 days. label Nov 26, 2022
@senadir senadir force-pushed the add/local-pickup-tax-locations branch 2 times, most recently from 05bb700 to c4744db Compare December 2, 2022 15:16
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2022

This should be moved inline for the settings page only.

This should be moved inline for the settings page only.


// @todo This should be moved inline for the settings page only.
$this->asset_data_registry->add(
'pickupLocationSettings',
get_option( 'woocommerce_pickup_location_settings', [] ),
true
);
$this->asset_data_registry->add(
'pickupLocations',
function() {
$locations = get_option( 'pickup_location_pickup_locations', [] );
$formatted = [];
foreach ( $locations as $location ) {

🚀 This comment was generated by the automations bot based on a todo comment in c4744db in #7433. cc @mikejolley

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2022

This should be improved to include error handling in case...

This should be improved to include error handling in case of API failure, or invalid data being sent that does not match the schema. This would fail silently on the API side.


// @todo This should be improved to include error handling in case of API failure, or invalid data being sent that
// does not match the schema. This would fail silently on the API side.
apiFetch( {
path: '/wp/v2/settings',
method: 'POST',
data,
} ).then( ( response ) => {
setIsSaving( false );
if (
isEqual(
response.pickup_location_settings,
data.pickup_location_settings
) &&

🚀 This comment was generated by the automations bot based on a todo comment in c4744db in #7433. cc @mikejolley

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2022

TypeScript Errors Report

Files with errors: 444
Total errors: 2135

⚠️ ⚠️ This PR introduces new TS errors on 14 files:

assets/js/base/components/cart-checkout/shipping-rates-control-package/package-rates.tsx

assets/js/base/components/cart-checkout/shipping-rates-control/types.ts

assets/js/base/components/cart-checkout/totals/shipping/shipping-address.tsx

assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/index.tsx

assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.tsx

assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/edit.tsx

assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/index.tsx

assets/js/extensions/payment-methods/cod/index.js

assets/js/extensions/shipping-methods/pickup-location/edit-location/form.tsx

assets/js/extensions/shipping-methods/pickup-location/edit-location/state-control.tsx

assets/js/extensions/shipping-methods/pickup-location/save.tsx

assets/js/extensions/shipping-methods/pickup-location/settings-context.tsx

assets/js/extensions/shipping-methods/shared-components/sortable-table/index.tsx

packages/checkout/components/store-notice/index.tsx

@mikejolley mikejolley removed the status: stale Stale issues and PRs have had no updates for 60 days. label Dec 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2022

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-7433.zip

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2022

Size Change: +58.6 kB (+6%) 🔍

Total Size: 1.08 MB

Filename Size Change
build/active-filters-frontend.js 7.99 kB +256 B (+3%)
build/active-filters-wrapper-frontend.js 6.01 kB -2 B (0%)
build/all-products-frontend.js 11.6 kB +277 B (+2%)
build/all-products.js 33.4 kB +15 B (0%)
build/all-reviews.js 7.67 kB +22 B (0%)
build/attribute-filter-frontend.js 22.9 kB +249 B (+1%)
build/attribute-filter-wrapper-frontend.js 7.68 kB -6 B (0%)
build/attribute-filter.js 12.4 kB +14 B (0%)
build/blocks-checkout.js 40.2 kB +654 B (+2%)
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.38 kB +1 B (0%)
build/cart-blocks/cart-cross-sells-products-frontend.js 9.62 kB +13 B (0%)
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.08 kB -2 B (0%)
build/cart-blocks/cart-express-payment-frontend.js 718 B +2 B (0%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.33 kB -4 B (0%)
build/cart-blocks/cart-line-items-frontend.js 1.06 kB -1 B (0%)
build/cart-blocks/cart-order-summary-frontend.js 1.25 kB +2 B (0%)
build/cart-blocks/cart-totals-frontend.js 321 B -1 B (0%)
build/cart-blocks/empty-cart-frontend.js 346 B +2 B (+1%)
build/cart-blocks/filled-cart-frontend.js 864 B +2 B (0%)
build/cart-blocks/order-summary-coupon-form-frontend.js 1.77 kB -1 B (0%)
build/cart-blocks/order-summary-discount-frontend.js 2.12 kB -2 B (0%)
build/cart-blocks/order-summary-fee-frontend.js 274 B +2 B (+1%)
build/cart-blocks/order-summary-heading-frontend.js 456 B +1 B (0%)
build/cart-blocks/order-summary-shipping-frontend.js 14.7 kB +172 B (+1%)
build/cart-blocks/order-summary-subtotal-frontend.js 274 B +1 B (0%)
build/cart-blocks/order-summary-taxes-frontend.js 435 B +2 B (0%)
build/cart-blocks/proceed-to-checkout-frontend.js 1.24 kB +4 B (0%)
build/cart-frontend.js 28.5 kB +395 B (+1%)
build/cart.js 47.3 kB +358 B (+1%)
build/checkout-blocks/actions-frontend.js 1.85 kB -8 B (0%)
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 3.91 kB +49 B (+1%)
build/checkout-blocks/billing-address-frontend.js 1.15 kB +28 B (+2%)
build/checkout-blocks/contact-information-frontend.js 2.05 kB +53 B (+3%)
build/checkout-blocks/express-payment-frontend.js 1.13 kB -3 B (0%)
build/checkout-blocks/fields-frontend.js 345 B +2 B (+1%)
build/checkout-blocks/order-note-frontend.js 1.14 kB +2 B (0%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.68 kB -5 B (0%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 1.93 kB -3 B (0%)
build/checkout-blocks/order-summary-discount-frontend.js 2.29 kB -4 B (0%)
build/checkout-blocks/order-summary-fee-frontend.js 276 B +1 B (0%)
build/checkout-blocks/order-summary-shipping-frontend.js 14.8 kB +176 B (+1%)
build/checkout-blocks/order-summary-subtotal-frontend.js 274 B +1 B (0%)
build/checkout-blocks/order-summary-taxes-frontend.js 436 B +3 B (+1%)
build/checkout-blocks/payment-frontend.js 8.33 kB -5 B (0%)
build/checkout-blocks/shipping-address-frontend.js 1.11 kB -1 B (0%)
build/checkout-blocks/shipping-methods-frontend.js 4.79 kB +237 B (+5%) 🔍
build/checkout-blocks/terms-frontend.js 1.56 kB -4 B (0%)
build/checkout-frontend.js 30 kB +649 B (+2%)
build/checkout.js 42.9 kB +1.95 kB (+5%) 🔍
build/customer-account.js 3.08 kB +1 B (0%)
build/featured-category.js 13.1 kB +24 B (0%)
build/featured-product.js 13.4 kB +32 B (0%)
build/filter-wrapper-frontend.js 14 kB +228 B (+2%)
build/filter-wrapper.js 2.4 kB +1 B (0%)
build/handpicked-products.js 7.24 kB +24 B (0%)
build/legacy-template.js 2.87 kB +28 B (+1%)
build/mini-cart-component-frontend.js 27.7 kB +247 B (+1%)
build/mini-cart-contents-block/empty-cart-frontend.js 366 B +2 B (+1%)
build/mini-cart-contents-block/filled-cart-frontend.js 468 B +1 B (0%)
build/mini-cart-contents-block/footer-frontend.js 2.82 kB +2 B (0%)
build/mini-cart-contents-block/items-frontend.js 237 B +1 B (0%)
build/mini-cart-contents-block/products-table-frontend.js 590 B +1 B (0%)
build/mini-cart-contents-block/shopping-button-frontend.js 313 B +1 B (0%)
build/mini-cart-contents-block/title-frontend.js 368 B +1 B (0%)
build/mini-cart-contents.js 16.9 kB +164 B (+1%)
build/mini-cart.js 4.29 kB +26 B (+1%)
build/price-filter-frontend.js 13.9 kB +272 B (+2%)
build/price-filter-wrapper-frontend.js 7 kB -9 B (0%)
build/price-filter.js 8.4 kB +9 B (0%)
build/product-add-to-cart-frontend.js 6.71 kB +1 B (0%)
build/product-add-to-cart.js 8.47 kB -8 B (0%)
build/product-best-sellers.js 7.61 kB +26 B (0%)
build/product-button-frontend.js 2.14 kB +3 B (0%)
build/product-categories.js 2.36 kB -2 B (0%)
build/product-category-list-frontend.js 1.14 kB -5 B (0%)
build/product-category.js 8.6 kB +24 B (0%)
build/product-image-frontend.js 2.14 kB -4 B (0%)
build/product-image.js 3.94 kB +5 B (0%)
build/product-new.js 7.6 kB +21 B (0%)
build/product-on-sale.js 7.92 kB +24 B (0%)
build/product-query.js 5.95 kB +23 B (0%)
build/product-rating-frontend.js 1.57 kB -2 B (0%)
build/product-sale-badge-frontend.js 1.37 kB -2 B (0%)
build/product-sale-badge.js 814 B -1 B (0%)
build/product-search.js 2.62 kB +1 B (0%)
build/product-stock-indicator-frontend.js 1.26 kB -5 B (0%)
build/product-summary-frontend.js 1.53 kB -6 B (0%)
build/product-tag-list-frontend.js 1.13 kB -6 B (-1%)
build/product-tag.js 8.09 kB +25 B (0%)
build/product-title-frontend.js 1.57 kB -3 B (0%)
build/product-title.js 3.31 kB +2 B (0%)
build/product-top-rated.js 7.83 kB +25 B (0%)
build/products-by-attribute.js 8.52 kB +21 B (0%)
build/rating-filter-frontend.js 21.4 kB +268 B (+1%)
build/rating-filter-wrapper-frontend.js 6.21 kB -12 B (0%)
build/rating-filter.js 7.43 kB +14 B (0%)
build/reviews-by-category.js 11.2 kB +23 B (0%)
build/reviews-by-product.js 12.3 kB +29 B (0%)
build/reviews-frontend.js 7.14 kB +253 B (+4%)
build/single-product-frontend.js 17.7 kB +320 B (+2%)
build/single-product.js 9.99 kB +28 B (0%)
build/stock-filter-frontend.js 21.1 kB +261 B (+1%)
build/stock-filter-wrapper-frontend.js 5.87 kB -13 B (0%)
build/stock-filter.js 8.17 kB +18 B (0%)
build/vendors--attribute-filter-wrapper--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary--237ee43d-frontend.js 0 B -6.86 kB (removed) 🏆
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--671ca56f-frontend.js 0 B -5.26 kB (removed) 🏆
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary-shipping--checkout-blocks--18f9376a-frontend.js 19.4 kB +293 B (+2%)
build/vendors--cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 7.53 kB +4 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.83 kB +1 B (0%)
build/vendors--checkout-blocks/shipping-methods-frontend.js 9.48 kB -1 B (0%)
build/wc-blocks-data.js 21.5 kB +288 B (+1%)
build/wc-blocks-editor-style-rtl.css 5.42 kB +14 B (0%)
build/wc-blocks-editor-style.css 5.42 kB +14 B (0%)
build/wc-blocks-google-analytics.js 1.56 kB +8 B (+1%)
build/wc-blocks-middleware.js 932 B +1 B (0%)
build/wc-blocks-registry.js 3.15 kB +236 B (+8%) 🔍
build/wc-blocks-shared-context.js 1.52 kB -3 B (0%)
build/wc-blocks-shared-hocs.js 1.73 kB +8 B (0%)
build/wc-blocks-style-rtl.css 25.5 kB +755 B (+3%)
build/wc-blocks-style.css 25.5 kB +758 B (+3%)
build/wc-blocks-vendors.js 64.2 kB +1.48 kB (+2%)
build/checkout-blocks/pickup-options-frontend.js 2.79 kB +2.79 kB (new file) 🆕
build/checkout-blocks/shipping-method-frontend.js 2.26 kB +2.26 kB (new file) 🆕
build/vendors--attribute-filter-wrapper--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary--82e4ed06-frontend.js 6.86 kB +6.86 kB (new file) 🆕
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--3c5fe802-frontend.js 5.26 kB +5.26 kB (new file) 🆕
build/vendors--checkout-blocks/shipping-method-frontend.js 12 kB +12 kB (new file) 🆕
build/wc-shipping-method-pickup-location.js 29.7 kB +29.7 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
build/active-filters.js 7.32 kB
build/cart-blocks/cart-cross-sells-frontend.js 253 B
build/cart-blocks/cart-items-frontend.js 299 B
build/checkout-blocks/order-summary-frontend.js 1.25 kB
build/checkout-blocks/totals-frontend.js 325 B
build/general-style-rtl.css 1.31 kB
build/general-style.css 1.31 kB
build/mini-cart-frontend.js 1.88 kB
build/price-format.js 1.19 kB
build/product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00.js 226 B
build/product-add-to-cart--product-button--product-image--product-rating--product-title.js 151 B
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 440 B
build/product-button--product-image--product-rating--product-sale-badge--product-title.js 258 B
build/product-button.js 3.84 kB
build/product-category-list.js 503 B
build/product-price-frontend.js 2.18 kB
build/product-price.js 1.54 kB
build/product-rating.js 920 B
build/product-sku-frontend.js 629 B
build/product-sku.js 376 B
build/product-stock-indicator.js 646 B
build/product-summary.js 920 B
build/product-tag-list.js 495 B
build/vendors--attribute-filter-wrapper--rating-filter-wrapper--stock-filter-wrapper-frontend.js 7.69 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB
build/wc-blocks-vendors-style-rtl.css 1.96 kB
build/wc-blocks-vendors-style.css 1.96 kB
build/wc-blocks.js 2.63 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-cod.js 909 B
build/wc-payment-method-paypal.js 837 B
build/wc-settings.js 2.6 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

Script Dependencies Report

There is no changed script dependency between this branch and trunk.

This comment was automatically generated by the ./github/compare-assets action.

@mikejolley mikejolley changed the title Local Pickup Locations Toggle and Blocks Feature: Checkout Block Local Pickup Toggle Dec 9, 2022
@github-actions
Copy link
Contributor

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-7433.zip

@mikejolley mikejolley force-pushed the add/local-pickup-tax-locations branch from a3386b2 to 1e6ff36 Compare December 15, 2022 15:48
@senadir senadir force-pushed the add/local-pickup-tax-locations branch 2 times, most recently from 56829db to b03435a Compare December 23, 2022 15:13
@senadir senadir force-pushed the add/local-pickup-tax-locations branch from 1560ac7 to fe155bf Compare January 12, 2023 11:43
@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2023

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-7433.zip

Script Dependencies Report

There is no changed script dependency between this branch and trunk.

This comment was automatically generated by the ./github/compare-assets action.

TypeScript Errors Report

  • Files with errors: 488
  • Total errors: 2256

⚠️ ⚠️ This PR introduces new TS errors on 19 files:

assets/js/base/components/cart-checkout/shipping-rates-control-package/package-rates.tsx

assets/js/base/components/cart-checkout/shipping-rates-control/types.ts

assets/js/base/components/cart-checkout/totals/shipping/shipping-address.tsx

assets/js/base/components/radio-control/option-layout.tsx

assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/index.tsx

assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.tsx

assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/edit.tsx

assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/index.tsx

assets/js/extensions/payment-methods/cod/index.js

assets/js/extensions/shipping-methods/pickup-location/edit-location/form.tsx

assets/js/extensions/shipping-methods/pickup-location/edit-location/state-control.tsx

assets/js/extensions/shipping-methods/pickup-location/general-settings.tsx

assets/js/extensions/shipping-methods/pickup-location/save.tsx

assets/js/extensions/shipping-methods/pickup-location/settings-context.tsx

assets/js/extensions/shipping-methods/shared-components/settings-card/index.tsx

assets/js/extensions/shipping-methods/shared-components/settings-modal/index.tsx

assets/js/extensions/shipping-methods/shared-components/settings-section/index.tsx

assets/js/extensions/shipping-methods/shared-components/sortable-table/index.tsx

packages/checkout/components/store-notice/index.tsx

comments-aggregator

@senadir senadir changed the title Feature: Checkout Block Local Pickup Toggle Introduce Local Pickup to Checkout Jan 12, 2023
@senadir senadir force-pushed the add/local-pickup-tax-locations branch from a5ce9ef to da6951b Compare January 12, 2023 14:46
Copy link
Member

@senadir senadir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a quick glance, LGTM, :shipit:

@github-actions github-actions bot added this to the 9.4.0 milestone Jan 12, 2023
@senadir senadir merged commit 80c6b26 into trunk Jan 13, 2023
@senadir senadir deleted the add/local-pickup-tax-locations branch January 13, 2023 12:19
@dinhtungdu
Copy link
Member

@mikejolley @senadir Look like this PR introduces a PHP warning in the block editor

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: checkout Issues related to the checkout block. type: enhancement The issue is a request for an enhancement.
Projects
None yet
3 participants