I am trying to add items to a cart without leaving a list view of products and submitting a page redirect on the form action, does anyone know if this is possible or what I may need to do to get this to work properly? My add to cart form looks like this:
- <perch:form id="add_to_cart" app="perch_shop" action="#add_to_cart">
- <perch:input id="product" type="hidden" value="<perch:shop id="productID" env-autofill="false" />" />
- <perch:input id="qty" class="quantity" value="1" type="number" min="1" />
- <perch:input class="add-to-cart" type="submit" value="Add to cart" />
Since the action is going to an anchor on the same page, the form works if I add one product, but if I click on a separate item and add that to the cart on the same page, it only increments the original item quantity in the cart, not a new item.
Here is the relevant page: http://staging.europeanfoodstore.ca/products
If I change the action to action="/cart" it works as intended, but I am assuming I need the submit event to reload the page or something similar. Can anyone shed some light on what might be needed for this to work? My intention is to show a modal on submission, but not leave the page.
Thank you in advance,