HELP NEEDED: Adding "add to cart" button on the homepage collections without redirect (SUPPLY THEME)

Highlighted
New Member
3 0 0

Hi I used the following code to put "add to cart" buttons on the homepage collections within the Supply theme:

<form method="post" action="/cart/add">
  <input type="hidden" name="id" value="{{ product.variants.first.id }}" />
 
  <input type="submit" value="Add to cart" class="btn" />
      <input type="hidden" name="return_to" value="back" />
</form> 

 

However when the button is clicked it redirects to the PDP. How can I edit the code to allow add to cart without having to redirect?

Any help is greatly appreciated! Thank you in advance!

0 Likes