简体   繁体   中英

Woocommerce Redirect to custom page depending on order status

Is it possible to redirect users to custom order-thank you pages depending on order status?

Order Complete -> /standard-order-received-page/
Order Processing -> /custom-redirect-page

Hope help:

add_action( 'woocommerce_thankyou', 'func_redirectcustom');

function func_redirectcustom( $order_id ){
    $order = wc_get_order( $order_id );
    $url = 'https://yoursite.com/custom-url';

    if ( $order->has_status( 'processing' ) ) {

         wp_redirect( $url );
         exit;
    }
    // etc
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM