Hi,
I am using Empire theme. Whenever I click on “Add to Cart”, it automatically redirects me to the Cart page.
I would like to disable this, and allow the customer to stay on the same page instead.
Any advice on how I can achieve this with this theme?
Thanks very much.
Hi @muhammad-danish
It can be done using custom code, we can stop it using js, and add product into cart using ajax.
@dbuglab
Please provide the code to stop redirect function
You can do that from Online store > Themes > Customize > Theme settings > Products > uncheck option “Enable cart redirection”, click Save button
@Dan-From-Ryviu
I have done this, after doing that it shows popup from top to bottom
$("ADD_to_cart_button ID").click(function(){
event.preventDefault();
$.ajax({
/*** PUT ADD TO CART CODE HERE **/
});
});
Yes, it stay on the page stop redirecting to cart page ask your request. That is theme function.
You also can change style of that in Option style.
Edit: this option not for cart popup
@dbuglab
where I need to add this code?
In product detail page template.
@Dan-From-Ryviu
Can you provide the code to hide popup after adding product?
I have added this code, but it’s not working