Stop add to cart redirection after an error in Woocommerce

Share Now

Issue:
The page is automatically redirected to the product page and the “…has been added to your cart” message is displayed at the top.

Fix

// Stop redirecting after stock error
add_filter( 'woocommerce_cart_redirect_after_error', '__return_false' );
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert