Stop Stripe Loading On Every Page

[ad_1]

Is this possible yet? I see threads from years ago with the same issue but nothing has changed, no fix that I can see in the setting or anything.

Currently js.stripe.com loads every page, and is likely the difference between my Google Core Web Vitals being red instead of yellow, that extra few milliseconds makes all the difference (if it’s that small, it might be slowing things down more..)

How can I have it just loading on checkout pages? Apple Pay/Google Pay are set to checkout page only. It still loads every page. I think something to do with optional/additional fraud detection as Stripe tracks user movements and so automatically loads every page as part of the plugin, but what if we don’t want that?

IS there code that removes it?

I found this:

https://github.com/woocommerce/woocommerce-gateway-stripe/pull/2110

Where it mentioned the following code:

add_filter( ‘wc_stripe_load_scripts_on_product_page_when_prbs_disabled’, ‘__return_false’ );
add_filter( ‘wc_stripe_load_scripts_on_cart_page_when_prbs_disabled’, ‘__return_false’ );

But I don’t want to be messing around with code if I don’t know what I’m doing. ANyone used this successfully? Will adding this to functions.php work?

Thanks.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer