Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #135637

    Bruce
    Participant

    If your interested in setting up a custom thank you page after someone makes a purchase from your store, (bypassing the standard ‘order received’ page. Simply place the following snippet in your child theme functions php section.

    // Redirect custom thank you
     
    add_action( 'woocommerce_thankyou', 'redirectcustom');
     
    function redirectcustom( $order_id ){
        $order = new WC_Order( $order_id );
     
        $url = 'http://yoursite.com/my-cool-thank-you-page';
     
        if ( $order->status != 'failed' ) { 
            echo "<script type='text/javascript'>window.location = '" . $url . "'</script>";
        }
    }

    I searched everywhere to do something like this, hope it helps you as it did me 🙂

    #135789

    Cousett
    Member

    Thank you for your contribution. I am sure this will help out many looking for this feature.