• Resolved Sigurd Watt

    (@sigurdwatt)


    In the plugin ‘woocommerce-gateway-stripe’ there is a file called woocommerce-gateway-stripe.php

    On line 734 there is this line: add_action( ‘plugins_loaded’, ‘woocommerce_gateway_stripe_init’ );

    I want to REMOVE this action as I don’t want the scripts which it triggers to run.

    I have tried various ways to remove it including things like this:

    add_action(‘plugins_loaded’, ‘remove_stripe_action_wp_loaded’, 200);

    function remove_stripe_action_wp_loaded() {
    // Remove the action if it exists
    if ( has_action('plugins_loaded', 'woocommerce_gateway_stripe_init') ) {
    remove_action('plugins_loaded', 'woocommerce_gateway_stripe_init');
    error_log('Successfully removed woocommerce_gateway_stripe_init from plugins_loaded on wp_loaded.');
    }

    However, it is very stubborn and nothing I try is working. Is there a specific WooCommerce hook which I can hook into in order to stop this from running? I only want it to not run on certain pages which is why I am doing this and not just disabling it.

    You will know that you ahve disabled it correctly if there is no API called made to – https://js.stripe.com/v3/?ver=3.0

    Right now this is being called on this page and it is really slowing it down

    • This topic was modified 3 months, 1 week ago by Sigurd Watt.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello Sigurd Watt,

    Thank you for contacting Woo support.

    I understand you want to disable this action:
    add_action( ‘plugins_loaded’, ‘woocommerce_gateway_stripe_init’ );
    Your goal is to stop the scripts from running which are loaded by this action.

    Is this query related to performance improvement?
    If so then I recommend posting it on the WooCommerec Github.
    There our developers can look into your query and check if this is something that can be improved in the code.

    I hope this helps.
    Let me know if you have any questions??

    Best regards.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.