Handling of Stripe JS with GDPR & minifier plugins #9709
Labels
focus: checkout payments
priority: high
The issue/PR is high priority—it affects lots of customers substantially, but not critically.
type: bug
The issue is a confirmed bug.
Describe the bug
The checkout button is missing in mobile view on the WooCommerce site when using WooPayments with the Cookiebot plugin enabled. The issue appears to stem from the Cookiebot plugin altering the loading behavior of the Stripe JavaScript. Specifically, Cookiebot changes the
<script>
type of Stripe’s script fromtext/javascript
totext/plain
due to cookie consent settings, which prevents Stripe from loading correctly, thereby causing WooPayments elements not to display on checkout.To Reproduce
Actual behavior
In mobile view, the checkout button is missing on the WooCommerce checkout page. The console displays the following error:
Additionally, attempting to manually initialize Stripe in the console returns:
Inspecting the page source reveals that the Stripe script is enqueued with
type="text/plain"
instead oftype="text/javascript"
, likely due to Cookiebot’s handling of cookie consent.https://plugins.trac.wordpress.org/browser/cookiebot/trunk/src/lib/helper.php#L151
Expected behavior
The WooPayments checkout button and Stripe payment fields should load and be fully functional on the checkout page in mobile view, without requiring additional manual actions. The Stripe JavaScript should load without interference from Cookiebot
Additional context
Potential solution ideas include leveraging JavaScript Proxies to detect when
Stripe
is added to thewindow
object and then triggering the initialization of WooPayments.p1727770367173279-slack-CGGCLBN58
p1722007079535099-slack-CU6SYV31A
The text was updated successfully, but these errors were encountered: