Add-to-Cart button on collections page

Solved
Highlighted
New Member
6 0 0

Hi,

 

I want to display add-to-cart button and quantity selection on my collections page, this is my website: https://londongrocery.net/

 

I checked similar topics and found one, however in this one proposed solution suggests adding the code below  into product-card.grid however I do not have this snippet!

 

Thanks in advance!

Cagdas

This is the link to similar topic and proposed 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>

https://community.shopify.com/c/Shopify-Design/How-to-add-quot-add-to-cart-quot-button-on-my-collect...

0 Likes
Highlighted
Shopify Partner
620 100 140

Hello @Cagdas,

 

1. Go to Online Store->Theme->Edit code>Snippets
2. Add a new sippet
add-to-cart
 
place this code in new created snippet add-to-cart
<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>
 
3 Go to again Snippets Folder, search product-grid-item.liquid and place this
 
{% include 'add-to-cart' %}
  </div>
</div>
 
 
Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: wahabahmadghori@gmail.com

 

2 Likes
Highlighted
New Member
6 0 0

Hi Wahab,

 

Thanks for your answer! I do not have  product-grid-item.liquid , I am using Simple as template, most similar one to this I have is 

list.collections-template.liquid. Is this suggestion still valid for this snippet?

Thanks,

Cagdas

0 Likes
Highlighted
Shopify Partner
620 100 140

This is an accepted solution.

@Cagdas,  I have solved your problem.

kindly like and accept my solution 

1 Like
Highlighted
New Member
6 0 0

hi Wahab, thanks a lot for your response! It solved my problem.

Can you please point me to the code you added and I can have a look into it .

 

Best,

Cagdas

0 Likes
Highlighted
New Member
6 0 0

Thanks a lot again @Wahab_Ahmad for the solution, there's only one small issue, after adding to cart it automatically goes to check-out page whereas I want customers to stay on the collections page and go to check out when they click on the basket icon. Is this changable in the code you provided?

0 Likes
Highlighted
Tourist
8 0 2

Hi Cagdas

 

Did you figure out how to amend code so the customer stays on the page and can continue adding items to cart?

1 Like
Highlighted
Excursionist
20 0 1
Best solution!
0 Likes
Highlighted
Excursionist
20 0 1

Best solution! Thank you.

0 Likes
Highlighted
Excursionist
14 0 1

@Wahab_Ahmad

I would also like to introduce the "Add to cart" button on the DEBUT topic. Can you help me please?

Site:  https://tatuajetemporary.ro/

0 Likes