All things Shopify and commerce
Hello!
I'm not sure what I did but since a few days ago I can no longer use any product variants, the default one is always selected.
https://savonsmy.com/products/bombe-de-bain-effervescente
the first one "Ananas-Mangue" will end up in the cart even if you select anything else.
From what I can see the theme code looks fine, but when the user selects another variant, the property selected="selected" does not change...
I can see the following errors in the JS console but I have no clue what they mean or how to fix it...
theme.js?v=20177681164921879581617110627:8008 Uncaught TypeError: Cannot read properties of null (reading 'innerHTML') at new t (theme.js?v=20177681164921879581617110627:8008:50) at theme.Sections._createInstance (theme.js?v=20177681164921879581617110627:47:34) at theme.Sections.<anonymous> (theme.js?v=20177681164921879581617110627:141:14) at NodeList.forEach (<anonymous>) at theme.Sections.register (theme.js?v=20177681164921879581617110627:139:69) at HTMLDocument.<anonymous> (theme.js?v=20177681164921879581617110627:9536:12)
Whichs routes to
this.cartRoutes = JSON.parse( document.querySelector('[data-cart-routes]').innerHTML );
And this...
TypeError: Cannot read properties of undefined (reading 'includes') at Ef.j (m=IZT63,ZyYHPb,ws9Tlc,vfuNJf,PrPYRd,hc6Ubd,Das5Le:231:447) at Gf (m=_b,_tp,_r:88:266) at If.next (m=_b,_tp,_r:89:91) at m=_b,_tp,_r:89:485 at new Promise (<anonymous>) at Jf (m=_b,_tp,_r:89:378) at _.Kf (m=_b,_tp,_r:89:520) at K0 (m=IZT63,ZyYHPb,ws9Tlc,vfuNJf,PrPYRd,hc6Ubd,Das5Le:230:503) at Ef.j (m=IZT63,ZyYHPb,ws9Tlc,vfuNJf,PrPYRd,hc6Ubd,Das5Le:230:276) at Gf (m=_b,_tp,_r:88:266)
The theme used is Debut.
Any help would be greatly appreciated!
Solved! Go to the solution
This is an accepted solution.
Alright so I managed to solve the problem by adding the following javascript code inside theme.liquid file... No clue how it was working before and why it stopped working....
<script type="application/json" data-cart-routes>
{
"cartUrl": "{{ routes.cart_url }}",
"cartAddUrl": "{{ routes.cart_add_url }}",
"cartChangeUrl": "{{ routes.cart_change_url }}"
}
</script>
This is an accepted solution.
Alright so I managed to solve the problem by adding the following javascript code inside theme.liquid file... No clue how it was working before and why it stopped working....
<script type="application/json" data-cart-routes>
{
"cartUrl": "{{ routes.cart_url }}",
"cartAddUrl": "{{ routes.cart_add_url }}",
"cartChangeUrl": "{{ routes.cart_change_url }}"
}
</script>
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024