Thread tagged as: Question, Shop

Submitting multiple products with one button


Is it possible to add 2 products to my cart with 1 submit button.

            <perch:form id="add_to_cart" app="perch_shop" action="/shop/winkelwagen">
                <perch:input id="product" type="hidden" env-autofill="false" value="1" />
                <perch:input id="product" type="hidden" env-autofill="false" value="2" />
                <perch:input type="submit" class="custom-btn primary mt-0" value="Voeg toe" />

This won't work, is there a way to do this?

Thanks, Mike

Mike Hendriks

Mike Hendriks 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't directly like that, but yes, it's absolutely possible.

How could I implement that inside a template? I would like to have a checkbox > if checked: add product 1 & 2, if not checked: add only product 1.

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, you can't implement that in a template. You'll need to post to a script and run through your form data adding the products. There's nothing built in for this - you'll need to do it yourself.