Hi All,
Been searching the forums and net for almost 2 hours and there are all kinds of solutions but it only solves 1 aspect of the problem.
For starters:
Im using the debut theme.
I’ve added the ADD TO CART button to my collections.
I’ve added the ajax code to my header, and product cart codes.
I’ve solved the adding to cart from a product page not redirecting to the cart.
I have a featured collection on my main page with add to cart buttons below each item.
I’m trying to not have it redirect to the product page when adding to cart on home page via the featured collection.
How do I do that?
URL is: www.galingdyan.com
Password: Test123
I’m at my wits end.
Thanks in advance!
1 Like
Hello,
Your store is password locked. Kindly share the password.
Thank you!
Sorry! I just added the password I forgot it was locked since this is before launch. : )
Hey @GalingDyan
Find this code In asset->theme.js->find “$.post(params)”.
If your theme contains this then follow this:
add location.href=“/cart”;
So it looks like:
$.post(params)
.done(
function(item) {
this._hideErrorMessage();
this._setupCartPopup(item);
location.href="/cart";
}.bind(this)
)
Hope this will work for you.
Thanks!
1 Like
@dmwwebartisan
Thanks for the swift reply.
added but still takes me to the product page when adding to cart on the main page.
See code above if I did it right. 
1 Like
Hey @GalingDyan ,
Are you using ajaxsify?
Please share your button code.
Thanks!
Yup using ajaxify for the cart function.
For the button code:
added this at the end of product-card-grid,liquid
1 Like
Hello @GalingDyan
please add code Snippets/product-card-grid.liquid bottom of the file.
Hope this will work for you.
Thanks!
2 Likes
That work fantastically!
You are a legend!
I hope this helps others as well.
2 Likes
Just wanted to say a massive THANK YOU!
I’m using the Simple theme and had managed to get my add to cart button working on my collection pages but it kept redirecting to the cart. I know hardly anything about coding. Your response sorted the cart redirect out so customers can remain in the collection and keep shopping.
You’re a total legend!
1 Like
This did not work for me. I am having the exact same issue, tried different codes but the button still takes me to the product page!
Any ideas?