Open danielmx-dev opened 5 days ago
9770
or branch name fix/9709-load-stripe-asynchronously
in your-test.site/wp-admin/admin.php?page=jetpack-beta&plugin=woocommerce-payments :rocket: Launch a JN site with this branch :rocket:
:information_source: 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: +676 B (0%)
Total Size: 1.34 MB
Filename | Size | Change |
---|---|---|
release/woocommerce-payments/dist/blocks-checkout.js |
54.4 kB | +120 B (0%) |
release/woocommerce-payments/dist/cart-block.js |
16.9 kB | +123 B (+1%) |
release/woocommerce-payments/dist/checkout.js |
33.1 kB | +83 B (0%) |
release/woocommerce-payments/dist/express-checkout.js |
15 kB | +97 B (+1%) |
release/woocommerce-payments/dist/product-details.js |
12.1 kB | +80 B (+1%) |
release/woocommerce-payments/dist/tokenized-express-checkout.js |
16.2 kB | +95 B (+1%) |
release/woocommerce-payments/dist/woopay-express-button.js |
24.6 kB | +78 B (0%) |
This was testing well with the initial test cases. When I attempted to test Pay for Order, I noticed the credit card form wasn't loading. Testing further while logged in, it seems Stripe JS isn't being loaded other pages like Checkout and Cart either. This is likely related to the the hardcoded changes in the Cookiebot plugin combined with the fact that the banner doesn't appear when logged in (so cookies can't be accepted), but I want to double check with you on this and whether you've been able to test while logged in?
I assume it may be related to this setting ? Cookiebot CMP on front-end while logged in
However, I'm not able to replicate the issue with the setting On or Off. I would assume that if the banner doesn't show up then the script shouldn't be blocked.
Fixes #9709
Changes proposed in this Pull Request
WCPayAPI#getStripe
method from synchronous to asynchronous. This allow us to wait for Stripe.js to load in scenarios where the script download may be delayed due to third party plugins that ask for user's consent (see details in #9709).Testing instructions
Script_Loader_Tag::__construct
in the plugin code to always set thescript_loader_tag
filter.Cookiebot_Addons::build_container
in the plugin code:$this->container->get( 'Script_Loader_Tag_Interface' )->add_tag( 'stripe', array( 'marketing', 'statistics' ) );
Before
ReferenceError: Stripe is not defined
document.cookie = 'CookieConsent=; Path=/;';
After:
Regression Testing
Disable Cookiebot and verify that the same pages (Blocks/Classic Checkout, Cart (Blocks and Classic), Product Pages.) continue working as expected.
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