Redirect to Cart after adding to basket

[ad_1]

Hello @cedricbaguilar chances are you have a setting set in your theme that’s doing that. Out of the box WooCommerce doesn’t do that.

Please go to WooCommerce > Settings > Products and make sure the Redirect to Cart is not enabled in the Add to cart behaviour section.

Hi @serafinnyc

Thanks a lot for the quick answer. I already checked that and nothing is selected. There would be the button for redirection to the cart, but not actually the checkout page, which is what happens in my case. So I have no idea where this comes from. Also in terms of redirection the thank you page on my website as well is customized but nothing really displays as is designed and the built in purchase summary is not at all displayed…

It appears someone has added custom hooks @cedricbaguilar or you’re using a plugin that’s doing this. Check your plugins and I’d also check within the theme’s functions.php file and or Astra’s settings.

How do I exactly check for this in particular. I have a lot of plugins, and I am not sure that I can check all their function.php Is there a quick way for me to check this?

You want to look for an app called cart, checkout or something redirect @cedricbaguilar and the same goes for functions.php

That hook might look like this:

function redirect_to_checkout_after_add_to_cart() {
// Only redirect on single product pages
if (is_product()) {
wp_safe_redirect(wc_get_checkout_url());
exit;
}
}
add_action('woocommerce_add_to_cart', 'redirect_to_checkout_after_add_to_cart');

I see well thanks. Wouldn’t it maybe be easier for me to just create a code snippet that tells not to redirect?

And then for the thank you page, what advice could you give there?

@cedricbaguilar No, not necessarily. It’s best to find these things in order to operate a well maintained website.

For the Thank You page I’ll wait for one of my colleagues to answer that as I can’t think of any off the top of my head. Plus if you already have a redirect plugin added it’s best to use that one then.

Haha, yes agreed it is good to find the cause of the problem and fix it. I found the culprit plugin and it is was codesigner. I will now look for the redirection function there and try to solve it that way.

For the thank you page the plugin works well, the redirection as such works, but the final site is not displayed as it should, which is a pity…

Excellent 🤙🏼 best of luck. Let us know if you need any further assistance with this. If anything new please create a separate ticket. Thanks

Thanks for your help. I appreciate the quick answers!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer