Support » Plugin: Stripe Payments for WordPress - WP Simple Pay » error with v2.3.0 and Divi

  • Resolved Stéphane PISKORZ

    (@stefanp44)


    Hi,

    I’m not sure if it’s related or not, but after the last update, I get this error

    Uncaught ReferenceError: StripeCheckout is not defined
        at Object.setupStripeCheckout (public.min.js:6)
        at Object.setupCoreForm (public.min.js:6)
        at HTMLFormElement.<anonymous> (public.min.js:6)
        at Function.each (jquery.js:2)
        at n.fn.init.each (jquery.js:2)
        at Object.init (public.min.js:6)
        at HTMLDocument.<anonymous> (public.min.js:6)
        at i (jquery.js:2)
        at Object.fireWith [as resolveWith] (jquery.js:2)
        at Function.ready (jquery.js:2)

    I use the latest WordPress and Divi versions. I switched back to 2.2.0 for the time being, but I’d like to know how to correct that.

    Best regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author spencerfinnell

    (@spencerfinnell)

    Hello Stéphane,

    Are you using any other plugins that utilize the legacy version of Stripe Checkout?

    If both v2 (legacy) and v3 (recent — what WP Simple Pay uses) versions of the Stripe scripts are loaded on the same page it would cause an error like this.

    If you need to exclude WP Simple Pay’s v3 script from interfering with another plugin on your website you can see how to exclude the assets from certain pages here: https://github.com/wpsimplepay/WP-Simple-Pay-Snippet-Library/blob/master/conditionally-dequeue-scripts-styles.php

    Hello Spencer,

    I did try the script you provided but it didn’t work. I went further on testing: deactivationg all plugins didn’t work either, still the same error. However, I switched to a WordPress default theme and the redirect towards Stripe payment page worked this time. I switched back to Divi, same error.
    Should I contact Divi support about this?

    Plugin Contributor Adam Lea

    (@adamjlea)

    Hello @stefanp44,

    Yes, I think reaching out Divi at this point is probably the best course of action. They would be better suited I believe to diagnose what is happening.

    Regards,

    Hi @adamjlea,

    I reached out to them, waiting for a reply. I’ll keep you posted though.

    have a nice day

    Hi @adamjlea, @spencerfinnell,

    After discussing with Divi support, it appears that my child theme was the cause of this, specifically this piece of code, used to remove the version of CSS and JS from the code source. Somehow, it seems to create a conflict with Simple Pay

    // REMOVE VERSION FROM SCRIPTS AND STYLES
    function pm_remove_version_scripts_styles($src) {
    	if (strpos($src, '?ver=')) {
    		$src = remove_query_arg('ver', $src);
    	}
    	return $src;
    }
    add_filter('style_loader_src', 'pm_remove_version_scripts_styles', 1000);
    add_filter('script_loader_src', 'pm_remove_version_scripts_styles', 1000);
    Plugin Author spencerfinnell

    (@spencerfinnell)

    Thank you @stefanp44

    Removing the query strings doesn’t allow your browser to easily identify that it needs to load a non-cached version of the plugin scripts, which is likely why you saw the error — one old script trying to reference a new script.

    You may be able to keep the code in place and clear your browser cache, but it is highly likely your website users will experience a similar problem as you have, which is why I would recommend keeping it removed.

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