Issue setLanguage in SPA navigation

Hello,
I’m using the Javascript API to set the language like that:

document.addEventListener('snipcart.ready', function() {
        Snipcart.api.session.setLanguage('fr');
    });

I’m using Gridsome (A framework of Vue.js) I noticed that the setLanguage is not working during navigation but only when I refresh the pages.

How can I Fix this problem?

Thanks :slight_smile:

Is it possible that Snipcart reloads when you do a page change? This might create some issues here.

We usually recommend making sure that Snipcart is included outside of your router view to make sure our script loads only when the page loads the first time.

Otherwise, you might get weird issues since our script will load even when not required.

When building a single page application, you don’t need to reload Snipcart on every page change since the routing is done in JavaScript and the whole page isn’t refreshed.