-
Notifications
You must be signed in to change notification settings - Fork 71
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
fix: attribute selection from PDPs with tokenized ECE #10306
Conversation
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: +24 B (0%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
@@ -37,14 +37,16 @@ addFilter( | |||
'wcpay.express-checkout.cart-add-item', | |||
'automattic/wcpay/express-checkout', | |||
( productData ) => { | |||
const $variationInformation = jQuery( '.single_variation_wrap' ); | |||
if ( ! $variationInformation.length ) { | |||
const variationInformation = document.querySelector( |
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.
I moved away from the jQuery selectors and switched to vanilla JS selectors, so that testing would be more reliable and easier (without having to mock jQuery)
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.
This tests well for me and I was able to use tokenized ECE to checkout with a variable product with special characters in the attribute and value. I also appreciate the jquery conversion 🙏
👍
Fixes #10303
Changes proposed in this Pull Request
Plugins like "Variation Swatches for WooCommerce" might alter the page's HTML structure, causing the ECE to not be able to parse the selected variation on a product page.
When such thing occurs, the

POST cart/add-item
call fails to get the product prices when the all the product variation attributes are selected.Testing instructions
Repeat the above steps with the "Variation Swatches for WooCommerce" plugin.
Repeat the above steps with these changes to your local
wp-content/plugins/woocommerce/src/StoreApi/Utilities/CartController.php
file.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