Issue with Bundled Section Rendering not responding

Solved

Issue with Bundled Section Rendering not responding

ben0915
Shopify Partner
8 1 1

Hi Shopify Community,

 

I’m currently implementing a dynamic cart update using the Shopify Ajax API and am encountering an issue where the cart items, the cart icon bubble,  don’t visually update without a page reload after a successful POST request.

 

Here is the code I’m using to update the cart:


await postToCart('cart/add.js', {
    items: [{
      quantity: 1,
      id: VARIANT_ID,
      properties: { _custom: true, price }
    }],
    sections: "cart-items,cart-icon-bubble,main-cart-items,cart-footer",
    sections_url: "/cart"
  });
I have tried all variations of the `sections` param & sections_url: "/cart"
- `sections: "cart-items", "cart-icon-bubble" , "main-cart-items", "cart-footer",`
- `sections: ["cart-items,cart-icon-bubble,main-cart-items,cart-footer"],`
- `sections: ["cart-items", "cart-icon-bubble" , "main-cart-items", "cart-footer"],`
- and many more but to no avail
 

I’m referencing the Bundled Section Rendering documentation to update the cart sections dynamically, but it’s not triggering a re-render without a page refresh.

Could you provide guidance on how to properly trigger the dynamic updates for these sections, so the cart visually reflects the changes?

 

 

Accepted Solution (1)

ben0915
Shopify Partner
8 1 1

This is an accepted solution.

UPDATE --> SOLUTION SOLVED. 

comment here if anyone needs

View solution in original post

Replies 4 (4)

ben0915
Shopify Partner
8 1 1

This is an accepted solution.

UPDATE --> SOLUTION SOLVED. 

comment here if anyone needs

FlorianRueckert
Shopify Partner
1 0 0

I am also encountering issues with the section rendering API. How did you solve this?

ben0915
Shopify Partner
8 1 1
Send your code block here. Let’s take a look at it
BrunoDL
Shopify Partner
6 0 0

I have a scenario where it work on the live version but not on the local development... 

But it's using the formData object. I have no clue why this is happening