Forum
Shop cart remove item without causing form action
Is there a way to run the remove from cart button when the perch cart form has an action without calling that action? So on form submit I want to send the user to checkout: <perch:form id="cart" app="perch_shop" class="cart__form" action="/hires/checkout">
but on remove item I want to keep the user on the cart page. I can't use a link for the submit button as I am setting additional cart-properties which require the form to be submitted to be set and passed through.
Yes, you can call
perch_shop_remove_from_cart()
to programatically remove items from the cart. Have your script remove them from the page and then ping a page back on the server to remove them from the cart using that function.Thanks. For anyone else, here is how I finally managed it:
(the remove item button) cart.html:
Master Page URL pattern:
hires/remove-item/[slug:id]
remove-item.php: