Add 'Add to Cart' Button anywhere on home page

Highlighted
New Member
2 0 1

This question has been answered in the past, but the code mentioned to add the 'add to cart' button is old. I am using 'Debut' theme.

I want to add 'Add to Cart' button in the products(collection) section on the homepage. 

 

Please help.

 

 

1 Like
Highlighted
Shopify Expert
154 17 21

You can use the code from this thread to add a quantity selector and Add To Cart button:

https://community.shopify.com/c/Shopify-Design/Adding-an-quot-Add-to-Cart-quot-Button-to-Collection-...

W3trends is one of the leading app developers in the Shopify ecosystem. We can handle anything E-commerce or App related for your business. Feel free to message me if you need any work done!
0 Likes
Highlighted
New Member
2 0 1

I used the following code :

 

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

I got the error :
Screen Shot 2020-06-02 at 4.36.18 PM.png 

 

I think the value of "product.variants.first.id" is missing.

0 Likes