Remove Stripe JS
-
We’re being asked to remove Stripe js on non-essential pages. I just want to make sure that this is not possible still correct? Someone has gotten it into our client’s head that it’s doable.
function custom_dequeue_stripe_assets() {
if ( ! is_checkout() && ! is_cart() && ! is_product() ) {
// Dequeue Stripe JS scripts
wp_dequeue_script( 'stripe' );
wp_dequeue_script( 'wc-stripe' );
wp_dequeue_script( 'wc-stripe-payment-request' );
// Deregister the external Stripe JS
wp_deregister_script( 'stripe' );
// Dequeue Stripe CSS styles
wp_dequeue_style( 'wc-stripe-style' );
wp_dequeue_style( 'wc-stripe-payment-request-css' );
}
}
add_action( 'wp_enqueue_scripts', 'custom_dequeue_stripe_assets', 99 );I did try this but it didn’t work and I’m trying to prove a point to this client that we cannot control external files. Just need urgent confirmation I’m not going insane. Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Remove Stripe JS’ is closed to new replies.