Pjax navigation (Barba.js)

Antonin
Shopify Partner
4 0 1

Hi guys, 

I'm trying to implement PJAX navigation with Barba.js inside a custom Shopify theme but I got some weird behaviors with cart routes url / login urls.  My cart becomes empty or I'm logout during navigation. 
I'm thinking it's an issue with request and headers sent within pjax navigation...

Does anyone has advise on this subject or had already configure barba.js into a liquid theme ?

Regards, 
Antonin

0 Likes
pattwala
Shopify Partner
1 0 0

Hi Antonin. Did you make any progress on this front? I'm curious to know if barba works with Shopify as well. Thanks.

0 Likes
Antonin
Shopify Partner
4 0 1

Hi @pattwala ,

I succeed to use Barba.js. It works well for most of pages but I needed to prevent some shopify routes. I had some issues with missing cookies on specific pages. I guess cookies added by shopify javascript and because of pjax, these scripts aren't executed.
So I used classic navigation for all account and bag routes.

Hope that helps :) 

0 Likes

hi @Antonin 

 

can you please share store url where you have used barba.js?

 

thanks 

0 Likes
newyarektimes
New Member
1 0 0

I think it has to do with barba.js caching.

Adding this line solved it for me:

 

barba.init({
//...
cacheIgnore: ['/cart'],
//...
})

 

0 Likes