Narrative Theme: Collection page - how to stop Add to Cart button Redirect to Cart Page

roselyn_025
Tourist
3 0 3

Hi! Please help.. I'm having a hard time fixing the add to cart button on collection page to stop redirecting on cart page.

Is there any way to fix it?

Appreciate any help. Thanks in advance!

Replies 6 (6)

Wahab_Ahmad
Shopify Partner
773 114 200

Hello @roselyn_025, share the store link. 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Chat on WhatsApp .
Feel free to contact me Email : wahabahmadghori@gmail.com |
Buy Me A Coffee
roselyn_025
Tourist
3 0 3

Here's the store link

https://partnersinwine.com.au/collections/frontpage

It's a password protected.

password: wine

 

When you click on a single product for example:

https://partnersinwine.com.au/collections/frontpage/products/2018-rachis-syrah

and click add to cart button, it stays on the same page. 

That's what I wanted to do on collection pages, but it's doesn't work

Wahab_Ahmad
Shopify Partner
773 114 200

@roselyn_025,

1. Go to Online Store->Theme->Edit code
2. Asset->theme.js->paste below code at bottom of files

 

$(document).ready(function(){
$('.product__add-to-cart-button').click(function(){window.history.back();})
});

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: wahabahmadghori@gmail.com

 

 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Chat on WhatsApp .
Feel free to contact me Email : wahabahmadghori@gmail.com |
Buy Me A Coffee
roselyn_025
Tourist
3 0 3

@Wahab_Ahmad thanks for your reply. I tried that but didn't work.. 

meandatree
Excursionist
25 0 3

Hi Roselyn

I see that you were able to implement the non-redirect button on your collections which look great and work as I have been trying to get to for the past few days. Any help will be gladly appreciated. My website is www.meandatree.com. Cheers

David

meandatree
Excursionist
25 0 3

Hi there,

How were you able to eliminate the redirect to cart? Need help with this been trying for a while . I got this far but glitchy when page button refreshes, and their is no "View Cart" button. https://www.meandatree.com/collections/best-natural-soaps 

Much appreciated

Cheers

<form method="submit" action="/cart/add">
<input type="hidden" name="id" value="{{ product.variants.first.id }}" />
<input class="product-form__quantity-input" type="number" id="Quantity-product-template" name="quantity" value="1" min="1" pattern="[0-9]*" style="padding-left: 105.925px; opacity: 1;">
<button class="btn btn--to-secondary btn--full product__add-to-cart-button shopify-payment-btn btn--secondary" data-cart-submit="" type="submit" name="add" aria-label="Add to Cart">
<span class="primary-text" aria-hidden="false" data-cart-primary-submit-text="">
Quick Shop
</span>
<span class="secondary-text" aria-hidden="true" data-cart-secondary-submit-text="">View cart</span>
</button>
<input type="hidden" name="return_to" value="back" />

Appreciate any help Thanksnarrative no redirect success.JPG