Adding an "Add to Cart" Button to Collection Pages in Debut Theme

New Member
7 0 0

 

 


@Amanie wrote:

Hello there !

 

This was helpful to me too, thanks ! but how can i stop it from redirecting to the cart page once the customer presses " add to cart", since the whole point of creating the selector outside the item card is to avoid the back & forth.. 

 


If you haven't found a solution yet, move the code to outside of the last div (the original instructions we were all following have it inside the div)

 

 

0 Likes
Excursionist
27 2 1

I created a Shopify Buy Button from Settings / Sales Channels for my two products.  Then I added a Custom Content section, deleted the two default sections, then added a new section for HTML.  I pasted the Buy Button code in the HTML section.  It works like a charm on desktop and mobile.

0 Likes
New Member
3 0 0

Hi there 

So this is working Great , 

jus 1 more thing to this, 

How to change it So  after i Do add to the Cart    To stay on the same page and not Jump to the Cart,?

 

Thanx A lot!

0 Likes
New Member
3 0 0

hi Brydon, 

 

i'm trying to add the below code to the product-grid AND the search result page too, but i cant find them in snippets in symmetry 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" />
</form>

 

please advise.

0 Likes
New Member
1 0 0

same here... did you find the solution ?

I tried the solution to add the button on the colleciton page + ajaxify, but it still leads me to the cart page...

Thx,

 

0 Likes
New Member
2 0 0

This looks good on desktop but the Add To Cart button is oversized on my mobile page (See photo attached).How can I change the size of the button while keeping everything as is on desktop?WechatIMG334.jpeg

0 Likes
New Member
1 0 0

I can't locate "product-grid-item.liquid". Would you please help? 

0 Likes
New Member
1 0 0

Thank you so much!

0 Likes
Highlighted
New Member
1 0 0

Hey! I'm using Venture, and I just got my "add to cart button" to stay on the same page.

 

1. Locate product.card.liquid

2. At the very end, after the </a>, post this code:

 

<div class="list-view-item__price-column">
{% if product.available %}
{% include 'product-unit-price', variant: product %}
{% endif %}
<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" />
<input type="hidden" name="return_to" value="back" />
</form>
</div>

0 Likes
Shopify Partner
7 0 1

Hi William, I'm hoping ypou're still there. This is a great help.

I would like to have the product name/text  and the qty cell and the 'add to..' button all center aligned under the product image in these Collection pages and for that matter the featured collection on the home page.

Any pearls of wisdom would be helpful.

Thanks

Rob

0 Likes