WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WooCommerce] Redirect to cart on thanks page when order doesn't exist

[Plugin: WooCommerce] Redirect to cart on thanks page when order doesn't exist

  • I’d like to request a feature. If a user tries to directly access the ‘Thank you’ page, they should be redirected to the cart (or home page) if there isn’t an order in $_GET.

    Could you add the the following (or similar) to woocommerce_functions.php – woocommerce_redirects() ?

    // When on thank you page with no query string, redirect to cart page
    if (is_page(woocommerce_get_page_id('thanks')) && !isset($_GET['order'])) :
        wp_redirect(get_permalink(woocommerce_get_page_id('cart')));
        exit;
    endif;

    Thanks,

    Alex

  • The topic ‘[Plugin: WooCommerce] Redirect to cart on thanks page when order doesn't exist’ is closed to new replies.
Skip to toolbar