WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. alextiley
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic