Support » Plugin: WooCommerce » Add to Cart and Redirect to Previous Page

Viewing 1 replies (of 1 total)
  • // Redirect user to previous page after adding to basket
    function custom_add_to_cart_redirect() {
    	$url = htmlspecialchars($_SERVER['HTTP_REFERER']);
        return $url;
    }
    add_filter('add_to_cart_redirect', 'custom_add_to_cart_redirect');

    Seems to work for removing the add to cart url but I am still on the same page. Any way I can go back two pages?

    Thanks,
    Ian

Viewing 1 replies (of 1 total)
  • The topic ‘Add to Cart and Redirect to Previous Page’ is closed to new replies.