The default line item id is the variant id, which for me is not unique enough (there are some properties which change for the same variant). How does one override the line item ID?

I tried changing data-id attribute directly in my cart.liquid template but no success.

I want to be able to provide a hashed string, such as S32FDA for the line item id.

1 Answers

drip On Best Solutions

You can't modify the variant ID with something else. The variant ID is the thing you submit to your cart-> checkout process, so modifying it in some way is out of the question.

If you have properties for the variants then indeed it will be hard to update them using only variants id, for that you will have to use lines ( the row position of the line_item ) instead.

Example:'/cart/update.js', {updates: [3, 2, 1]});

This will update the items in your cart to have 3, 2 and 1 quantity.