Hi,
In Javascript, when I get cart via cart.js I dont get collection data of the products in the cart? How do I do that on the storefront?
Thanks,
Gaurv
Hi,
In Javascript, when I get cart via cart.js I dont get collection data of the products in the cart? How do I do that on the storefront?
Thanks,
Gaurv
The cart wont return data based off what collection the product is in. Products can exist in multiple collections.
You’ll have different solutions based off what you need to do
Add collection information to the line item via line item properties when adding the product to the cart. This custom information will be available in the Cart API
Fetch the product
endpoint with each ID and query it’s collections
Thanks. Fetching products id by id would be slow for my request. I was hoping there is another way
You’ll need theme customizations that add hidden line properties containing the information you need, then.
I am writing a shopify app and so unfortunately cannot do theme customizations