Add to cart without going to detail page

Martin_Scott
New Member
15 0 0

Hello,

 

I'm using the simple theme and was wondering if it was possible to be able to add a product to the cart without having to click on the item and go to the detail page.  In other words I would want an "Add to cart" button on the product page. 

 

Thanks

 

0 Likes
Benjamin_C
Shopify Staff
Shopify Staff
368 0 40

Hello Martin, Ben here - your Shopify Guru! 

  You can do this just go to Themes > Template Editor > Snippets > product-grid-item.liquid, and add an add to cart form in there, where you need it:

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

To have the button directly below the price just put that code before the last </div> tag in the code.

I hope this helps! Feel free to reach out if you have any further questions :)

Cheers,
Ben C - Shopify Guru
Support@Shopify.com

 

0 Likes
penpalingpaula
New Member
1 0 0

Hello,

I have this same doubt but I am with the Debut theme and I can't find the product-grid-item.liquid file. 

There is a product-card-grid.liquid, produc-card-list.liquid, product-price.liquid and product-price-listing.liquid.

Where should I add that piece of code? 

Thank you so much for your help,

Paula

0 Likes