Checkout screen causes reload in Gatsby site

I’ve attached snipcart to my Gatsby site using the standard script tags. I haven’t used the gatsby-plugin-snipcart plugin. That might be my next option.

The problem happens when I click my buy now button and add an item to my basket, the fly out ‘Cart summary’ appears with my item added to the basket just fine. When I click the ‘Checkout’ button at the bottom, the checkout screen appears, ‘/#/checkout’ is added to the end of my pages url, causing a reload, the checkout is then no longer visible and I can’t see the checkout screen. Clicking my buy now button and doing the same thing just repeats the same thing over and over.

I set snipcart up on my gatsby site over a year ago and it was working then. Now I’ve come back to this project again I don’t know what has changed and wondered if anyone knew how to fix this issue.

Thanks,

Hi @mdurks, thanks for reaching out.

Which version of Snipcart are you using? This was a known issue that should be fixed in the latest releases.

Thanks,

Hi @nelitow , thanks for responding quickly.

The script I have added is:
https://cdn.snipcart.com/themes/v3.3.1/default/snipcart.js

I’ve tracked down what it is, it’s not to do with Snipcart.

I have an event listener for popstate, and that was picking up the url change from snipcart and causing the refresh. I will have to re-think that listener and the functionality behind it.

Does snipcart have to append what it does to the url when you open the checkout, is there a way to disable that?

Thanks,

Thanks for sharing.

Unfortunately we can’t disable our routing system at the moment, but if there is any other way we might help, please let us know.