Remote add to cart with custom data

New Member
1 0 0

Hope this helps someone. I was stuck for a while trying to figure this out.

We have a product where customers leave shopify and land on a remote site. They customize their product on the remote site and then return to Shopify to continue shopping. We wanted to have a [Add to Cart] button on the remote site that would add the item along with the customized data to the cart of our shopify store.

Permalinks didn't work -- couldn't add the custom data to the line item, only the cart.

Storefront API didn't work -- couldn't add item to the shopify cart already in user's session.

Solution: Forms



<form action="" method="post">
	<input name="id" value="{{the_variant_id}}" type="hidden">
	<input id="oid" name="properties[{{custom_key}}]" value="{{the_custom_data}}" type="hidden">
	<input value="Add to cart" type="submit">




Permalinks are somewhat limited because they perform a GET request with the only modifier being quantity.

Posting form data gives us more options by letting us pass data via the format properties[your_data_key]