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

Cart and Checkout block transforms for classic shortcodes #11228

Merged
merged 29 commits into from Oct 19, 2023

Conversation

mikejolley
Copy link
Member

@mikejolley mikejolley commented Oct 12, 2023

What

This PR improves the incompatibility flow for cart and checkout blocks when non compatible extensions are detected.

Task List

Adds a task list item to review the cart/checkout blocks. This notice is only visible if using blocks on the cart/checkout pages, and will redirect to either the checkout page, or cart page, on click.

Screenshot 2023-10-17 at 14 51 37

Incompatibility notices

The notice wording is updated, and a convenient switch button is introduced to revert to classic shortcodes:

Screenshot 2023-10-17 at 14 55 03

Clicking the switch button opens a confirmation model to make sure the merchant understands the ramifications of reverting to shortcodes:

Screenshot 2023-10-17 at 14 56 33

Confirming will replace the blocks with the classic shortcode. There is a snackbar shown giving the option to undo the action:

Screenshot 2023-10-17 at 14 57 15

Block Transforms

This PR also includes transforms to convert from block->shortcode even if the notice is hidden:

Screenshot 2023-10-17 at 15 15 45

Fixes #10848

Why

This allows easier switching back to shortcodes if the block based checkout is not working or suitable for a store, and encourages merchants to check their pages are correctly configured.

Follow ups

cc @ralucaStan Creating some follow ups so we can at least ship something in time in case these turn out to be complex tasks.

Testing Instructions

Please consider any edge cases this change may have, and also other areas of the product this may impact.

Prerequisite: Ensure you're already using cart and checkout blocks and you have an incompatible extension installed. You can use WooCommerce Checkout Field Editor as an example.

  1. Go to WooCommece > Home. There should be a task list item "Review your shopper's checkout experience". Click it. You should be taken to the page editor.
  2. Edit the cart page
    1. Edit the cart page
    2. Focus on the parent cart block and click its icon. You should be able to transform to "classic cart"
    3. Refresh the editor
    4. Focus on the cart block. See the incompatibility notice in the sidebar. Click the "switch to classic cart" button.
    5. Modal should open. Click switch. Block should be replaced.
    6. In the snackbar bottom left, click "undo". Should revert back to blocks.
  3. Repeat above tests for checkout block. Pay attention to wording and ensure any references to "cart" are updated with "checkout" during the process.
  • Do not include in the Testing Notes
  • Should be tested by the development team exclusively

Screenshots or screencast

Screen.Recording.2023-10-17.at.16.24.13.mov

WooCommerce Visibility

Required:

  • WooCommerce Core
  • Feature plugin
  • Experimental
  • N/A

Checklist

Required:

  • This PR has either a [type] label or a [skip-changelog] label.
  • This PR is assigned to a milestone.

Conditional:

  • This PR has a changelog description (if [skip-changelog] label is not present).
  • This PR adds/removes a feature flag & I've updated this doc.
  • This PR adds/removes an experimental interfaces, and I've updated this doc.
  • This PR has been accessibility tested.
  • This PR has had any necessary documentation added/updated.

Changelog

Added tools to switch between Cart and Checkout Blocks and Classic Shortcodes when non-compatible payment extensions are detected.

@mikejolley mikejolley added the type: enhancement The issue is a request for an enhancement. label Oct 12, 2023
@mikejolley mikejolley self-assigned this Oct 12, 2023
@mikejolley mikejolley changed the title Cart and Checkout block transforms for classic shortcodes [WIP] Cart and Checkout block transforms for classic shortcodes Oct 12, 2023
@woocommercebot woocommercebot requested review from a team and wavvves and removed request for a team October 12, 2023 14:03
@github-actions
Copy link
Contributor

github-actions bot commented Oct 12, 2023

The release ZIP for this PR is accessible via:

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

Script Dependencies Report

The compare-assets action has detected some changed script dependencies between this branch and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Removed
cart-style.js wp-notices ⚠️
checkout-style.js wp-notices ⚠️
classic-shortcode-style.js wc-settings 🎉

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

TypeScript Errors Report

  • Files with errors: 523
  • Total errors: 2335

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

assets/js/blocks/cart/edit.js

assets/js/blocks/cart/index.js

assets/js/blocks/checkout/index.tsx

assets/js/blocks/classic-shortcode/index.tsx

assets/js/editor-components/incompatible-extension-notice/index.tsx

comments-aggregator

@github-actions
Copy link
Contributor

github-actions bot commented Oct 12, 2023

Size Change: +60.7 kB (+4%)

Total Size: 1.54 MB

Filename Size Change
build/1796-frontend.js 0 B -23.2 kB (removed) 🏆
build/7138-frontend.js 0 B -24.2 kB (removed) 🏆
build/active-filters-frontend.js 6.7 kB -331 B (-5%)
build/active-filters-rtl.css 1.68 kB -329 B (-16%) 👏
build/active-filters-wrapper-frontend.js 7.04 kB -353 B (-5%)
build/active-filters-wrapper-rtl.css 1.53 kB -332 B (-18%) 👏
build/active-filters-wrapper.css 1.53 kB -332 B (-18%) 👏
build/active-filters.css 1.68 kB -328 B (-16%) 👏
build/active-filters.js 6.16 kB -343 B (-5%)
build/all-products-frontend.js 9.88 kB +5 B (0%)
build/all-products-rtl.css 4.53 kB -22 B (0%)
build/all-products.css 4.53 kB -24 B (-1%)
build/all-products.js 39.8 kB -292 B (-1%)
build/attribute-filter-frontend.js 19.9 kB -410 B (-2%)
build/attribute-filter-rtl.css 4.03 kB -131 B (-3%)
build/attribute-filter-wrapper-frontend.js 21.2 kB -441 B (-2%)
build/attribute-filter.css 4.01 kB -132 B (-3%)
build/attribute-filter.js 11.3 kB -392 B (-3%)
build/base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss-rtl.css 2.97 kB -147 B (-5%)
build/base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss.css 2.97 kB -147 B (-5%)
build/blocks-checkout.js 33.9 kB -3 B (0%)
build/cart-blocks/cart-cross-sells-products-frontend.js 5.67 kB -5.25 kB (-48%) 🎉
build/cart-blocks/cart-line-items-frontend.js 9.23 kB -5.14 kB (-36%) 🎉
build/cart-blocks/cart-order-summary-frontend.js 21.1 kB +17.6 kB (+503%) 🆘
build/cart-blocks/order-summary-coupon-form-frontend.js 21.4 kB +17.5 kB (+452%) 🆘
build/cart-blocks/order-summary-discount-frontend.js 21.5 kB +17.5 kB (+440%) 🆘
build/cart-blocks/order-summary-shipping-frontend.js 21.1 kB +17.6 kB (+511%) 🆘
build/cart-frontend.js 28.9 kB -13 B (0%)
build/cart-rtl.css 9.61 kB -370 B (-4%)
build/cart.css 9.59 kB -366 B (-4%)
build/cart.js 40.1 kB +152 B (0%)
build/checkout-blocks/billing-address-frontend.js 10.2 kB -163 B (-2%)
build/checkout-blocks/order-summary-cart-items-frontend.js 6.6 kB -5.21 kB (-44%) 🎉
build/checkout-blocks/order-summary-coupon-form-frontend.js 21.5 kB +17.5 kB (+441%) 🆘
build/checkout-blocks/order-summary-discount-frontend.js 21.5 kB +17.5 kB (+430%) 🆘
build/checkout-blocks/order-summary-frontend.js 21.1 kB +17.6 kB (+491%) 🆘
build/checkout-blocks/order-summary-shipping-frontend.js 21.1 kB +17.6 kB (+498%) 🆘
build/checkout-blocks/order-summary-style.js 342 B +1 B (0%)
build/checkout-blocks/pickup-options-frontend.js 12.2 kB -5.21 kB (-30%) 🎉
build/checkout-blocks/shipping-address-frontend.js 10.2 kB -166 B (-2%)
build/checkout-blocks/shipping-method-frontend.js 2.34 kB -316 B (-12%) 👏
build/checkout-blocks/shipping-methods-frontend.js 19.9 kB -5.33 kB (-21%) 🎉
build/checkout-frontend.js 30.5 kB -14 B (0%)
build/checkout-rtl.css 9.31 kB -390 B (-4%)
build/checkout.css 9.3 kB -395 B (-4%)
build/checkout.js 43.5 kB +239 B (+1%)
build/classic-shortcode.js 4.63 kB +233 B (+5%) 🔍
build/filter-wrapper-frontend.js 14.5 kB -7 B (0%)
build/legacy-template.js 7.73 kB +11 B (0%)
build/mini-cart-component-frontend.js 30.7 kB +2 B (0%)
build/mini-cart-contents-block/products-table-frontend.js 8.58 kB -5.22 kB (-38%) 🎉
build/mini-cart-contents-rtl.css 3.22 kB -6 B (0%)
build/mini-cart-contents.css 3.21 kB -3 B (0%)
build/mini-cart-contents.js 15.9 kB -238 B (-1%)
build/mini-cart-frontend.js 2.35 kB +107 B (+5%) 🔍
build/mini-cart.js 6 kB +11 B (0%)
build/packages-style-rtl.css 4.21 kB +623 B (+17%) ⚠️
build/packages-style.css 4.21 kB +624 B (+17%) ⚠️
build/price-filter-frontend.js 7.97 kB -5.14 kB (-39%) 🎉
build/price-filter-rtl.css 2.68 kB -7 B (0%)
build/price-filter-wrapper-frontend.js 8.23 kB -5.12 kB (-38%) 🎉
build/price-filter-wrapper-rtl.css 2.53 kB -8 B (0%)
build/price-filter-wrapper.css 2.53 kB -10 B (0%)
build/price-filter.css 2.67 kB -8 B (0%)
build/price-filter.js 7.53 kB -242 B (-3%)
build/product-collection.js 13.6 kB -13 B (0%)
build/product-gallery.js 9.34 kB -1 B (0%)
build/product-price-frontend.js 2.81 kB -5.29 kB (-65%) 🏆
build/product-price-rtl.css 644 B -34 B (-5%)
build/product-price.css 643 B -34 B (-5%)
build/product-price.js 2.33 kB -322 B (-12%) 👏
build/product-template.js 2.76 kB -41 B (-1%)
build/rating-filter-frontend.js 18.8 kB -437 B (-2%)
build/rating-filter-rtl.css 4.08 kB -138 B (-3%)
build/rating-filter-wrapper-frontend.js 19.8 kB -442 B (-2%)
build/rating-filter.css 4.07 kB -141 B (-3%)
build/rating-filter.js 5.91 kB -426 B (-7%)
build/single-product.js 11 kB +4 B (0%)
build/stock-filter-frontend.js 19 kB -448 B (-2%)
build/stock-filter-rtl.css 3.88 kB -134 B (-3%)
build/stock-filter-wrapper-frontend.js 20.1 kB -445 B (-2%)
build/stock-filter.css 3.87 kB -134 B (-3%)
build/stock-filter.js 6.53 kB -424 B (-6%)
build/wc-blocks-editor-style-rtl.css 7.18 kB +98 B (+1%)
build/wc-blocks-editor-style.css 7.17 kB +93 B (+1%)
build/wc-blocks-vendors.js 61.7 kB -2.38 kB (-4%)
build/3810-frontend.js 18.3 kB +18.3 kB (new file) 🆕
build/blocks-components.js 7.32 kB +7.32 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
build/4124-frontend.js 23.9 kB
build/8280-frontend.js 8.48 kB
build/add-to-cart-form-rtl.css 375 B
build/add-to-cart-form.css 373 B
build/all-reviews-rtl.css 1.79 kB
build/all-reviews.css 1.79 kB
build/all-reviews.js 7.84 kB
build/attribute-filter-wrapper-rtl.css 1.65 kB
build/attribute-filter-wrapper.css 1.65 kB
build/breadcrumbs-rtl.css 234 B
build/breadcrumbs.css 234 B
build/breadcrumbs.js 2.03 kB
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.4 kB
build/cart-blocks/cart-accepted-payment-methods-style.js 153 B
build/cart-blocks/cart-cross-sells-frontend.js 268 B
build/cart-blocks/cart-cross-sells-products-style.js 153 B
build/cart-blocks/cart-cross-sells-style.js 269 B
build/cart-blocks/cart-express-payment-frontend.js 5.36 kB
build/cart-blocks/cart-express-payment-style.js 155 B
build/cart-blocks/cart-items-frontend.js 273 B
build/cart-blocks/cart-items-style.js 240 B
build/cart-blocks/cart-line-items-style.js 153 B
build/cart-blocks/cart-order-summary-style.js 341 B
build/cart-blocks/cart-totals-frontend.js 290 B
build/cart-blocks/cart-totals-style.js 253 B
build/cart-blocks/empty-cart-frontend.js 367 B
build/cart-blocks/empty-cart-style.js 365 B
build/cart-blocks/filled-cart-frontend.js 605 B
build/cart-blocks/filled-cart-style.js 333 B
build/cart-blocks/order-summary-coupon-form-style.js 155 B
build/cart-blocks/order-summary-discount-style.js 155 B
build/cart-blocks/order-summary-fee-frontend.js 288 B
build/cart-blocks/order-summary-fee-style.js 153 B
build/cart-blocks/order-summary-heading-frontend.js 346 B
build/cart-blocks/order-summary-heading-style.js 351 B
build/cart-blocks/order-summary-shipping-style.js 154 B
build/cart-blocks/order-summary-subtotal-frontend.js 291 B
build/cart-blocks/order-summary-subtotal-style.js 154 B
build/cart-blocks/order-summary-taxes-frontend.js 456 B
build/cart-blocks/order-summary-taxes-style.js 202 B
build/cart-blocks/proceed-to-checkout-frontend.js 7.59 kB
build/cart-blocks/proceed-to-checkout-style.js 1.08 kB
build/catalog-sorting-rtl.css 259 B
build/catalog-sorting.css 259 B
build/catalog-sorting.js 1.69 kB
build/checkout-blocks/actions-frontend.js 8.11 kB
build/checkout-blocks/actions-style.js 1.01 kB
build/checkout-blocks/billing-address-style.js 626 B
build/checkout-blocks/contact-information-frontend.js 2.08 kB
build/checkout-blocks/contact-information-style.js 651 B
build/checkout-blocks/express-payment-frontend.js 5.89 kB
build/checkout-blocks/fields-frontend.js 297 B
build/checkout-blocks/fields-style.js 271 B
build/checkout-blocks/order-note-frontend.js 1.14 kB
build/checkout-blocks/order-summary-cart-items-style.js 153 B
build/checkout-blocks/order-summary-coupon-form-style.js 155 B
build/checkout-blocks/order-summary-discount-style.js 154 B
build/checkout-blocks/order-summary-fee-frontend.js 291 B
build/checkout-blocks/order-summary-fee-style.js 155 B
build/checkout-blocks/order-summary-shipping-style.js 154 B
build/checkout-blocks/order-summary-subtotal-frontend.js 289 B
build/checkout-blocks/order-summary-subtotal-style.js 155 B
build/checkout-blocks/order-summary-taxes-frontend.js 456 B
build/checkout-blocks/order-summary-taxes-style.js 201 B
build/checkout-blocks/payment-frontend.js 15.6 kB
build/checkout-blocks/payment-style.js 504 B
build/checkout-blocks/pickup-options-style.js 476 B
build/checkout-blocks/shipping-address-style.js 515 B
build/checkout-blocks/shipping-method-style.js 1.43 kB
build/checkout-blocks/shipping-methods-style.js 450 B
build/checkout-blocks/terms-frontend.js 1.55 kB
build/checkout-blocks/terms-style.js 1.02 kB
build/checkout-blocks/totals-frontend.js 334 B
build/checkout-blocks/totals-style.js 301 B
build/classic-shortcode-rtl.css 242 B
build/classic-shortcode.css 241 B
build/collection-filters.js 1.63 kB
build/collection-price-filter-frontend.js 577 B
build/collection-price-filter-rtl.css 1.28 kB
build/collection-price-filter.css 1.28 kB
build/collection-price-filter.js 3.55 kB
build/customer-account-rtl.css 410 B
build/customer-account.css 409 B
build/customer-account.js 3.17 kB
build/featured-category-rtl.css 974 B
build/featured-category.css 973 B
build/featured-category.js 13.6 kB
build/featured-product-rtl.css 1.02 kB
build/featured-product.css 1.02 kB
build/featured-product.js 13.7 kB
build/filter-wrapper-rtl.css 378 B
build/filter-wrapper.css 378 B
build/filter-wrapper.js 2.37 kB
build/handpicked-products.js 7.22 kB
build/legacy-template-rtl.css 240 B
build/legacy-template.css 240 B
build/mini-cart-contents-block/cart-button-frontend.js 1.86 kB
build/mini-cart-contents-block/cart-button-style.js 1.23 kB
build/mini-cart-contents-block/checkout-button-frontend.js 1.95 kB
build/mini-cart-contents-block/checkout-button-style.js 1.43 kB
build/mini-cart-contents-block/empty-cart-frontend.js 374 B
build/mini-cart-contents-block/empty-cart-style.js 378 B
build/mini-cart-contents-block/filled-cart-frontend.js 284 B
build/mini-cart-contents-block/filled-cart-style.js 288 B
build/mini-cart-contents-block/footer-frontend.js 3.87 kB
build/mini-cart-contents-block/footer-style.js 1.95 kB
build/mini-cart-contents-block/items-frontend.js 247 B
build/mini-cart-contents-block/items-style.js 251 B
build/mini-cart-contents-block/shopping-button-frontend.js 501 B
build/mini-cart-contents-block/shopping-button-style.js 361 B
build/mini-cart-contents-block/title-frontend.js 2.04 kB
build/mini-cart-contents-block/title-items-counter-frontend.js 1.74 kB
build/mini-cart-contents-block/title-items-counter-style.js 1.2 kB
build/mini-cart-contents-block/title-label-frontend.js 1.68 kB
build/mini-cart-contents-block/title-label-style.js 1.14 kB
build/mini-cart-contents-block/title-style.js 1.38 kB
build/mini-cart-rtl.css 2.44 kB
build/mini-cart.css 2.45 kB
build/order-confirmation-additional-information-rtl.css 367 B
build/order-confirmation-additional-information.css 367 B
build/order-confirmation-additional-information.js 1.57 kB
build/order-confirmation-billing-address-rtl.css 398 B
build/order-confirmation-billing-address.css 397 B
build/order-confirmation-billing-address.js 1.55 kB
build/order-confirmation-billing-wrapper.js 1.5 kB
build/order-confirmation-downloads-rtl.css 477 B
build/order-confirmation-downloads-wrapper.js 1.57 kB
build/order-confirmation-downloads.css 478 B
build/order-confirmation-downloads.js 1.9 kB
build/order-confirmation-shipping-address-rtl.css 399 B
build/order-confirmation-shipping-address.css 398 B
build/order-confirmation-shipping-address.js 1.55 kB
build/order-confirmation-shipping-wrapper.js 1.5 kB
build/order-confirmation-status-rtl.css 280 B
build/order-confirmation-status.css 280 B
build/order-confirmation-status.js 1.54 kB
build/order-confirmation-summary-rtl.css 460 B
build/order-confirmation-summary.css 460 B
build/order-confirmation-summary.js 1.75 kB
build/order-confirmation-totals-rtl.css 594 B
build/order-confirmation-totals-wrapper.js 1.79 kB
build/order-confirmation-totals.css 593 B
build/order-confirmation-totals.js 2.16 kB
build/page-content-wrapper.js 1.85 kB
build/price-format.js 913 B
build/product-add-to-cart-frontend.js 8.11 kB
build/product-add-to-cart-rtl.css 1.38 kB
build/product-add-to-cart.css 1.38 kB
build/product-add-to-cart.js 8.35 kB
build/product-average-rating-frontend.js 1.88 kB
build/product-average-rating.js 1.4 kB
build/product-best-sellers.js 7.04 kB
build/product-button-frontend.js 4.93 kB
build/product-button-interactivity-frontend.js 8.48 kB
build/product-button-rtl.css 1.14 kB
build/product-button.css 1.14 kB
build/product-button.js 4.64 kB
build/product-categories-rtl.css 654 B
build/product-categories.css 654 B
build/product-categories.js 2.58 kB
build/product-category.js 7.97 kB
build/product-details-rtl.css 397 B
build/product-details.css 394 B
build/product-gallery-frontend.js 392 B
build/product-gallery-large-image-frontend.js 416 B
build/product-gallery-large-image-next-previous.js 4.15 kB
build/product-gallery-large-image.js 2.36 kB
build/product-gallery-pager.js 3.38 kB
build/product-gallery-rtl.css 1.08 kB
build/product-gallery-thumbnails.js 3.8 kB
build/product-gallery.css 1.08 kB
build/product-image-frontend.js 2.89 kB
build/product-image-gallery-rtl.css 307 B
build/product-image-gallery.css 306 B
build/product-image-rtl.css 996 B
build/product-image.css 994 B
build/product-image.js 2.68 kB
build/product-new.js 7.3 kB
build/product-on-sale.js 7.29 kB
build/product-query-rtl.css 350 B
build/product-query.css 349 B
build/product-query.js 11.5 kB
build/product-rating-counter-frontend.js 2.19 kB
build/product-rating-counter.js 1.71 kB
build/product-rating-frontend.js 2.53 kB
build/product-rating-rtl.css 247 B
build/product-rating-stars-frontend.js 2.43 kB
build/product-rating-stars-rtl.css 899 B
build/product-rating-stars.css 900 B
build/product-rating-stars.js 1.95 kB
build/product-rating.css 246 B
build/product-rating.js 2.05 kB
build/product-results-count-rtl.css 230 B
build/product-results-count.css 230 B
build/product-results-count.js 1.65 kB
build/product-reviews-rtl.css 458 B
build/product-reviews.css 458 B
build/product-sale-badge-frontend.js 2.01 kB
build/product-sale-badge-rtl.css 437 B
build/product-sale-badge.css 437 B
build/product-sale-badge.js 1.69 kB
build/product-search-rtl.css 419 B
build/product-search.css 417 B
build/product-search.js 2.6 kB
build/product-sku-frontend.js 2.02 kB
build/product-sku-rtl.css 240 B
build/product-sku.css 239 B
build/product-sku.js 1.53 kB
build/product-stock-indicator-frontend.js 2.19 kB
build/product-stock-indicator-rtl.css 232 B
build/product-stock-indicator.css 232 B
build/product-stock-indicator.js 1.71 kB
build/product-summary-frontend.js 2.35 kB
build/product-summary-rtl.css 549 B
build/product-summary.css 549 B
build/product-summary.js 1.87 kB
build/product-tag.js 7.5 kB
build/product-template-rtl.css 423 B
build/product-template.css 422 B
build/product-title-frontend.js 2.31 kB
build/product-title-rtl.css 693 B
build/product-title.css 694 B
build/product-title.js 2.04 kB
build/product-top-rated.js 7.57 kB
build/products-by-attribute.js 8.02 kB
build/rating-filter-wrapper-rtl.css 1.73 kB
build/rating-filter-wrapper.css 1.73 kB
build/reviews-by-category-rtl.css 1.79 kB
build/reviews-by-category.css 1.79 kB
build/reviews-by-category.js 11.4 kB
build/reviews-by-product-rtl.css 1.79 kB
build/reviews-by-product.css 1.79 kB
build/reviews-by-product.js 12.7 kB
build/reviews-frontend.js 6.52 kB
build/single-product-rtl.css 378 B
build/single-product.css 378 B
build/stock-filter-wrapper-rtl.css 1.49 kB
build/stock-filter-wrapper.css 1.49 kB
build/store-notices.js 1.67 kB
build/wc-blocks-classic-template-revert-button-style-rtl.css 240 B
build/wc-blocks-classic-template-revert-button-style.css 239 B
build/wc-blocks-classic-template-revert-button.js 1.18 kB
build/wc-blocks-data.js 19.6 kB
build/wc-blocks-google-analytics.js 1.16 kB
build/wc-blocks-middleware.js 735 B
build/wc-blocks-registry.js 2.74 kB
build/wc-blocks-rtl.css 2.47 kB
build/wc-blocks-shared-context.js 850 B
build/wc-blocks-shared-hocs.js 1.4 kB
build/wc-blocks.css 2.48 kB
build/wc-blocks.js 2.61 kB
build/wc-interactivity.js 10.7 kB
build/wc-payment-method-bacs.js 406 B
build/wc-payment-method-cheque.js 401 B
build/wc-payment-method-cod.js 508 B
build/wc-payment-method-paypal.js 437 B
build/wc-settings.js 2.4 kB
build/wc-shipping-method-pickup-location.js 29.3 kB

compressed-size-action

@ralucaStan ralucaStan marked this pull request as draft October 16, 2023 13:07
@mikejolley mikejolley force-pushed the add/checkout-block-to-shortcode-transform branch from 926f974 to 0314cea Compare October 16, 2023 14:46
@mikejolley mikejolley marked this pull request as ready for review October 17, 2023 15:27
@woocommercebot woocommercebot requested a review from a team October 17, 2023 15:28
@mikejolley mikejolley changed the title [WIP] Cart and Checkout block transforms for classic shortcodes Cart and Checkout block transforms for classic shortcodes Oct 17, 2023
@ralucaStan
Copy link
Contributor

I've tested the experience with a keyboard.
Some things I spotted:

  • the buttons inside the shortcode placeholder can't be reached by keyboard
  • Nice to have: after the switch to shortcode focus the shortcode placeholder. For example the block is focused after the switch

@mikejolley
Copy link
Member Author

I see in your video you tested with a block theme.

bdf0de6

When I replace with the shortcode the cart page look crowded. It should be a wider.

Seems to only affect TT1 non blocks.

Fixed by adding a wrapper class: a43da7d

the buttons inside the shortcode placeholder can't be reached by keyboard

I added a tabbable container; you can use arrow keys to navigate to the button area and tab to switch between the buttons. Not sure if this is the optimal solution but how tabbing between items in the editor works is not clear.

Ref: https://developer.wordpress.org/block-editor/reference-guides/components/navigable-container/

Nice to have: after the switch to shortcode focus the shortcode placeholder. For example the block is focused after the switch

Fixed in 6d8673e

@ralucaStan

Can we add telemetry to the editor? Namely, the "Switch to classic X" action in the notification and the actions available in the modal. In the task list, we inherit existing Tracks events (task view and task list), but in the editor we don't have anything. It would be useful to add this telemetry to have a complete picture of what's happening (view task > click task > click to switch to shortcode > confirm action)

Untested at present but I added 3 events in 659926a:

  • switch_to_classic_shortcode_click
  • switch_to_classic_shortcode_confirm
  • switch_to_classic_shortcode_cancel
  • switch_to_classic_shortcode_undo

@pmcpinto

Other changes:

  • Found an issue when testing TT1 where the placeholder was not visible due to the colors. Switched to SVG to fix: bb1cecd
  • Found an issue finding blocks for replacement/undo, so repurposed an existing findBlocks utility 6d8673e

@jarekmorawski
Copy link

After testing it, this change makes sense, as it follows the shopper flow: first the cart and then the checkout. @jarekmorawski do you agree?

Yes! Do we have some logic in place to take the user to one or the other if either cart or checkout is not present? I want to make sure we're accommodating use cases where the user only has block checkout, but not cart (and the other way around).

And kudos for adding keyboard navigation! Everything looks good to me.

@mikejolley
Copy link
Member Author

mikejolley commented Oct 18, 2023

Yes! Do we have some logic in place to take the user to one or the other if either cart or checkout is not present? I want to make sure we're accommodating use cases where the user only has block checkout, but not cart (and the other way around).

@jarekmorawski Right now its is setup to default to cart if the cart page contains either a cart block, or the classic cart placeholder. If it does not, it will fallback to checkout.

@wavvves wavvves removed their request for review October 19, 2023 09:04
@jarekmorawski
Copy link

Thanks, @mikejolley. I'm testing the flow and though I'm seeing the warning message in the inspector, there's no task on the Home screen. What did I miss? There's one small copy change to make in the inspector notice. I'll ping you in Figma.

@mikejolley
Copy link
Member Author

@jarekmorawski The task is coded to only show up if you've got a cart/checkout page setup and that page contains the blocks.

So under pages, it should look like this:
Screenshot 2023-10-19 at 12 09 17

And then those pages need to contain the blockified cart/checkout.

@jarekmorawski
Copy link

Wow! Thank you, I've learned something new today. I couldn't see the task because I went straight to the editor and added the blocks directly to the cart and checkout templates. Is there a reason why the default pages don't use them?

@mikejolley
Copy link
Member Author

@jarekmorawski The defaults will change in the next release, its being worked on separately!

@pmcpinto
Copy link

Untested at present but I added 3 events in 659926a:

@mikejolley thanks! I'm assuming that each event will have a prop to identify the block (cart or checkout), right?

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.

Additional changes make sense, left a single comment about an edge case but once that's fixed we can merge this.

assets/js/blocks/cart/edit.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ralucaStan ralucaStan left a comment

Choose a reason for hiding this comment

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

Great work here Mike. Thank you for your flexibility on this one and for taking the time to accommodate the tracking changes. 👏

@mikejolley mikejolley merged commit ea812d3 into trunk Oct 19, 2023
34 checks passed
@mikejolley mikejolley deleted the add/checkout-block-to-shortcode-transform branch October 19, 2023 15:43
@senadir
Copy link
Member

senadir commented Oct 19, 2023

@pmcpinto yes each event will have a prop named shortcode be cart or checkout

@pmcpinto
Copy link

@pmcpinto yes each event will have a prop named shortcode be cart or checkout

Thanks for the confirmation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mitigation flow for users with incompatible extensions
5 participants