Cart - Is there a link to pre-load the cart with a product including line item properties?

I’m trying to find a way to add a product with line item properties to a user’s existent cart using a link (without clearing their existent cart). I learned I can add items to an existent cart using this query string: https://example.com/cart/add?id[]=variantid

But does anyone know if there’s a way to include line item properties in that link?

My use case would be to include a link in an email to pre-load someone’s cart with a product, but this product requires custom line item properties. I know I could include some JS in the cart page and then add whatever I want to the cart after page load, but I’m wondering if there’s already a built-in way to do this server-side like in the link above.

Hi @felipebrahm ,

Yes, you can add line item properties to an existing cart in Shopify using a link. You just need to modify the URL format to include the line item properties you want. Here’s an example URL you can use:

https://yourstore.com/cart/add?id[]=123456&quantity=2&properties[Color]=Red&properties[Size]=Large

Replace “yourstore.com” with your own store’s domain, “123456” with the ID of the product variant you want to add, and “2” with the quantity of the product you want to add. Also, “Color” and “Size” are the line item properties you want to add, and “Red” and “Large” are the values of those properties.

When the customer clicks on this link, the product with the specified quantity and line item properties will be added to their cart without clearing it.

Unfortunately, you can’t add multiple variants with different line item properties in the same URL. Any variants you add to the URL will ALL have the same line item properties.

Hope this helps!