Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I have a question regarding Storefront API mutations.
What is the difference between the mutations “cartLinesUpdate” and “cartLinesAdd”?
I’ve noticed that both have the same effect, that is updating the quantity of the product I pass to the endpoint.
When should I use one or the other?
Thank you for any hint!
Hi Andrea,
For cartLinesUpdate you need the cart line_item_id to associate your update mutation with the correct line_item in the cart, but for cartLinesAdd you are adding a line_item to the cart so the id is not needed.
Cheers,
Gary