Rendering main-cart-footer in a Dawn mini cart

jrob
New Member
1 0 0

I've been building a mini cart on Dawn following this tutorial. https://scratchlabsdigital.com/shopify-2-0-dawn-how-to-mini-cart/

Everything is working well except for the main-cart-footer. The getSectionsToRender function in cart.js selects the main-cart-footer by data-id attribute which is available on the cart page. When the cart api is called bundled section rendering returns the html for the main-cart-footer just fine.

1.jpg2.jpg

When we are not on the cart page there is no dynamic id attribute is available. I have tried using the 'main-cart-footer' which is the static id of the section but the bundled section rendering doesn't return the dynamic content inside of cart__blocks.

3.jpg4.jpg

It's not possible to hard code dynamic id attribute because it changes. I have also tried using the sections_url parameter available set to the context of '/cart' and still get the empty area of the cart.
https://shopify.dev/api/ajax/reference/cart#bundled-section-rendering.

Anyone attempted this before or faced a similar issue?

Replies 0 (0)