• Resolved Dustin W. Stout

    (@dustinwstout)


    Expected behavior: Click one of the buttons, get redirected to Stripe Checkout page.

    Actual behavior: Click one of the buttons, page reloads

    I had set everything up last week, verified everything was working in Test mode. Then switched over to Live mode and everything was working fine there too.

    Came back today as I was getting ready to share our crowdfunding page with people to find the buttons (generated by WP Simple Pay shortcode) were not working.

    – I don’t have reCAPTCHA activated (no need… i’m not using forms).
    – I’ve deactivated all plugins (including WP Rocket)
    – cleared all caches (including browser… and tried other browsers with no cached pages for that site)
    – tried looking in the console for obvious errors (there are some, but none that looked like they came from Stripe/Simple Pay)

    I’ve tried everything I could think of and am coming up with nothing. Would appreciate some help on this.

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

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

    (@spencerfinnell)

    Hello @dustinwstout,

    I do see the JavaScript errors on your page as well. Even if they are not directly from WP Simple Pay it can still cause other scripts to fail.

    There is some invalid code in the header of your page that seems to be causing the issue:

    
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag(\'js\', new Date());
    
      gtag(\'config\', \'UA-123-123\');
    </script>
    

    Resolving or removing this code should ensure WP Simple Pay can function correctly.

    Thread Starter Dustin W. Stout

    (@dustinwstout)

    Yea, that’s the Google Analytics tag. I was trying to troubleshoot that… no idea how THAT script could fail. But went ahead and completely removed all Google Analytics tags and plugin…

    No change to WP Simple Pay buttons behavior.

    Plugin Author spencerfinnell

    (@spencerfinnell)

    Hello @dustinwstout,

    Please ensure you purge WP Rocket cache as the invalid code still appears in the page source when I view it.

    The code is invalid because of the extra \ characters.

    Edit: There is also an additional \ in this line:

    
    <script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-123-123\"></script>
    
    Thread Starter Dustin W. Stout

    (@dustinwstout)

    WP Rocket is disabled.

    Plugin Author spencerfinnell

    (@spencerfinnell)

    Hello @dustinwstout,

    Perhaps it needs to be reactivated and then the cache purged. I still see the following in the page source:

    
    <!-- This website is like a Rocket, isn't it? Performance optimized by WP Rocket. Learn more: https://wp-rocket.me -->
    
    Thread Starter Dustin W. Stout

    (@dustinwstout)

    Good call… still not working after reactivating, clearing caches, then deactivating again. No errors in the console for me now.

    Plugin Author spencerfinnell

    (@spencerfinnell)

    Hello @dustinwstout,

    Can you please verify that your WordPress theme’s footer.php outputs the following:

    
    <?php wp_footer(); ?>
    

    https://developer.wordpress.org/reference/functions/wp_footer/

    It appears WP Simple Pay’s scripts and styles are not being output on your page. If that line is in the theme, have you added any custom code to prevent scripts from outputting on a certain page? Or using another plugin to restrict asset loading?

    Thread Starter Dustin W. Stout

    (@dustinwstout)

    Found it.

    I was using a custom function to get rid of the scripts loading on all pages (except for the ones they NEEDED to be on). Apparently there was an error with that function.

    Thanks for spotting that! I didn’t think (or remember) to check that function.

    Plugin Author spencerfinnell

    (@spencerfinnell)

    Glad it’s all working as expected now Dustin; and thank you for the kind words in your review.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘button click just reloads page’ is closed to new replies.