• Resolved Stef

    (@serafinnyc)


    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)
  • Zee

    (@doublezed2)

    Hello Stef,

    Thank you for contacting Woo support.

    It’s correct that removing or selectively loading Stripe JavaScript on non-essential pages is not recommended. Modifying or removing JS scripts from the plugin can lead to unexpected issues and might affect the functionality of the payment gateway.

    For custom code-related questions, our support policy does not cover custom-coded solutions.
    However, you can seek advice from the Woo Community Slack or the Woo Community Facebook group.

    I hope this helps.

    Best regards.

    Thread Starter Stef

    (@serafinnyc)

    LOL @doublezed2 it’s me. I could have just DMd you on Slack then had I known you answer tickets here. 🤣😂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove Stripe JS’ is closed to new replies.