Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Ajax Cart API missing item_components data - not unified with liquid cart object

Ajax Cart API missing item_components data - not unified with liquid cart object

AV_SL
Shopify Partner
40 4 16

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?


Screenshot 2024-07-17 at 9.59.53 am.jpg

Thanks!

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
Replies 4 (4)

Liam
Community Manager
3108 344 910

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

AV_SL
Shopify Partner
40 4 16

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

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
Liam
Community Manager
3108 344 910

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

AV_SL
Shopify Partner
40 4 16

Thanks so much for your time @Liam Appreciate it!

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.