A space to discuss online store customization, theme development, and Liquid templating.
The Cart API doesn't support the same item_components data as the liquid cart, which creates a mismatch between the two data sources - and also means ajax specific carts can't show component items.
Cart.js
https://shopify.dev/docs/api/ajax/reference/cart#get-locale-cart-js
{
...
"items": {
...
"has_components": false,
...
}
...
}
cart.line_items liquid object
https://shopify.dev/docs/api/liquid/objects/line_item#line_item-item_components
{
...
"item_components": null,
...
}
Can we have a feature request to unify the Cart API response to include item_components similar to the liquid object for line_items?
Thanks!
Hi - just to confirm, the Cart API is working as expected but the AJAX API isn't showing the contents of the bundles, is this correct?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Yep - that's correct. Thanks @Liam
It is working as expected but the data isn't helpful, so this is more of a feature request to ensure both sources of cart data (from the AJAX API, and from Liquid) present the same item_components data.
This way displaying native bundle component items can be supported through both methods of rendering carts
I understand the issue how - it does seem that AJAX API may need to be updated ton accommodate for bundles, I'm connecting with our internal dev team on this.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks so much for your time @Liam Appreciate it!