Hi, I’m experiencing an issue with my online shop (creaddictive.fr ).
When I add a product to my cart, the item counter fails to update. I have to refresh the site to see the correct number of items in the cart. Currently, I need to leave my site offline, but I can share the collaborator code with you privately so you can assist me.
The theme of my site is up to date and is called Woodstock.
Thank you for your help.
tim_1
April 18, 2024, 3:10am
2
No need for collab access – storefront password would be enough and it’s safe to share it here.
tim_1
April 18, 2024, 9:23am
4
In assets/cart-drawer.js there is a function in class CartDrawer – it basically specifies what elements to update when cart is updated.
getSectionsToRender() {
return [
{
id: 'cart-drawer',
selector: '.cart-drawer__items'
},
{
id: 'cart-drawer',
selector: '.cart-drawer__footer--subtotal'
},
{
id: 'cart-icon-bubble'
}
];
}
Note that selector is missing from the last record – you need to add one like this:
{
id: 'cart-icon-bubble',
selector: '.header__cart-inner'
}
I wonder though, why it’s missing?
1 Like
Thank you for your help. I have just looked at the code in the cart-drawer.js file and I have a selector :
getSectionsToRender() {
return [
{
section: 'CartDrawer',
id: 'cart-drawer',
selector: '.cart-drawer__items'
},
{
section: 'CartDrawer',
id: 'cart-drawer',
selector: '.cart-drawer__footer--subtotal'
},
{
section: 'cart-icon-bubble',
id: 'cart-icon-bubble',
selector: '.shopify-section'
}
];
}
tim_1
April 18, 2024, 10:03am
6
This one is in a different class – CartDrawerItems @ line 102. It’s even in a different format.
Look in CartDrawer class, around line 83
Oh sorry! I don’t understand why this bit of code was missing, but now it works perfectly. Thanks again!
1 Like