I'm trying to update cart items with AJAX and Section Rendering API within the Dawn theme.
When I execute the code below in the cart page all works well on product item level - the product quantity updates and the price changes accordingly without page reload. However, the totals in cart-footer don't update.
I went trough Shopify's documentation and can't see what am I doing wrong in my code below.
let body = JSON.stringify({
updates: {
43222573449472: 2
},
"sections":[
"template--16499219595520__cart-items",
"cart-icon-bubble",
"cart-live-region-text",
"template--16499219595520__cart-footer"
]
});
fetch('cart/update.js', {...fetchConfig(), ...{ body }})
.then((response) => {return response.text();})
.then((state)=>{
const parsedState = JSON.parse(state);
document.getElementById('shopify-section-template--16499219595520__cart-items').innerHTML = parsedState.sections['template--16499219595520__cart-items']
})