Skip to content

Instantly share code, notes, and snippets.

@matt-cos
Last active April 25, 2023 02:13
Show Gist options
  • Save matt-cos/0fa39df47e8ed851723c03ecb269965a to your computer and use it in GitHub Desktop.
Save matt-cos/0fa39df47e8ed851723c03ecb269965a to your computer and use it in GitHub Desktop.
Shopify Snippets
{% comment %}
HTML product form that can add multiple products/quantities in one submit
The values are each a variant ID
{% endcomment %}
<form action="/cart/add" method="post">
<input type="hidden" name="items[0][id]" value="32387308847153">
<input type="number" name="items[0][quantity]" value="1">
<input type="hidden" name="items[0][properties][_Gift wrap]" value="No">
<input type="hidden" name="items[1][id]" value="32387357900849">
<input type="number" name="items[1][quantity]" value="1">
<select name="items[2][id]">
<option value="32387308847153">32387308847153</option>
<option value="32387357900849">32387357900849</option>
</select>
<select name="items[3][id]">
<option value="32387308847153">32387308847153</option>
<option value="32387357900849">32387357900849</option>
</select>
<input type="submit" value="Add to the cart" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment