Liquid, JavaScript, themes, sales channels
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.
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.
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?
Step 4 was updated a month or so back
Important Note: In order for the footer messaging and price to work in the mini cart, you will need to make sure that the main-cart-footer.liquid includes default settings:
"default": { "blocks": [ { "type": "subtotal" }, { "type": "buttons" } ] }
I think this is why it errors out. The Cart messaging can be a pain too.
User | RANK |
---|---|
24 | |
23 | |
12 | |
9 | |
8 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023