Checkboxes instead of Add to Cart buttons

New Member
2 0 0

Hello,

I'm looking to either add this setup to a specific collection or to a page that displays a collection.

I would like to give visitors an option to select a few products from what is presented to them and then press Add to Cart button once to add all of selected products to the cart. Is there a template that allows to do that or is this something we can come up with for future generations to enjoy :)

forum-question.jpg

 

0 Likes
Shopify Partner
421 79 90

Hello 

 

Yes its possible.
First create alternate template for collection, check here https://help.shopify.com/en/themes/customization/store/create-alternate-templates

Second use this code in your alternate template, example you can check here   (password: guleria )

<form action="/cart" method="post">
  

   <input type="submit" value="Add to the cart" />

<div id="accessories">
<ul>
{% for product in collections.all.products %}
{% for variant in product.variants %}
<li><input type="checkbox" name="id[]" value="{{ variant.id }}" /> {{ product.title }} - {{ product.price | money }} (<a href="{{ product.url }}" target="_blank" title="More details on {{ product.title }}">details</a>)</li>
{% endfor %}
{% endfor %}
</ul>
</div>
 </form>


 Thanks

Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
0 Likes
New Member
2 0 0

Thanks Guleria, 
Code worked partially, I get a list of my items with check boxes beside them, but when I select some and press Add to Cart it just sends me to the cart, but the cart is empty.

 

0 Likes
Shopify Partner
421 79 90

Strange, its working fine in my development store

Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
0 Likes
Shopify Partner
421 79 90

Please change form first line with this

<form action="/cart/add" method="post">
Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
1 Like