Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Phil Derksen

    (@pderksen)

    @krystianergotopia The reason for that is that historically, it’s been unreliable to detect shortcode usage in theme templates, custom plugins, widgets, etc.

    But 2 things…

    1) There is a workaround if you’re willing to add a bit of custom code. See https://github.com/moonstonemedia/WP-Simple-Pay-Snippet-Library/blob/master/conditionally-dequeue-scripts-styles.php and https://docs.wpsimplepay.com/articles/code-snippet-library/

    2) It’s on our feature list to do exactly what you stated by default, but add an option to allow loading on every page when there’s an issue.

    • This reply was modified 6 years, 11 months ago by Phil Derksen.
    • This reply was modified 6 years, 11 months ago by Phil Derksen.
    Thread Starter krystianergotopia

    (@krystianergotopia)

    I tried it with this code to dequeue your script and the oneclick-upsell script from woocurve (they use also stripe). Its working for woocurve but your scripts are still loading on every page. How do I have to adjust this code?

    function is_handsome_checkout(){
    if( get_post_type() == ‘handsome-checkout’ ){
    return true;
    }
    return false;
    }

    //add_action( ‘wp_enqueue_scripts’, ‘wc_dequeue_scripts’, 10 );
    add_action( ‘wp_footer’, ‘wc_dequeue_scripts’, 10 );

    function wc_dequeue_scripts() {
    if ( ! is_checkout() && ! is_account_page() && ! is_handsome_checkout() ) {
    wp_dequeue_script( ‘stripe’ );
    wp_dequeue_script( ‘ocustripe’ );
    }
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘stripe scripts loading on every page’ is closed to new replies.