Created
March 24, 2022 22:43
-
-
Save stevem21m/99a05aec890bf60d4a7ebc20a3492aed to your computer and use it in GitHub Desktop.
Shopify Add multiple items to the cart with one button
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% comment %} | |
| This will add all items from your collection to the cart | |
| Update you-collection with your collection tag name. | |
| {% endcomment %} | |
| {% assign collection = collections.your-collection %} | |
| {% paginate collection.products by 100 %} | |
| <form action="/cart" method="post"> | |
| {% if collection.products_count > 0 %} | |
| {% for product in collection.products %} | |
| {% if product.available %} | |
| {% for variant in product.variants %} | |
| {% if variant.available %} | |
| <input name="updates[{{ variant.id }}]" value="1" type="hidden" /> | |
| {% endif %} | |
| {% endfor %} | |
| {% endif %} | |
| {% endfor %} | |
| </div> | |
| {% endif %} | |
| {% if collection.products_count > 0 %} | |
| <div style="text-align:center;width:500px;margin-top:20px"> | |
| <input class="button" type="submit" value="BUY ALL" /> | |
| </div> | |
| {% endif %} | |
| </form> | |
| {% endpaginate %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment