Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

redirect woocommerce thank you

add_action( 'woocommerce_thankyou', 'woocommerce_custom_thank_you_page');
  
function woocommerce_custom_thank_you_page( $order_id ){
    $order = wc_get_order( $order_id );
    $url = 'https://yoursite.com/custom-page-url';
    if ( ! $order->has_status( 'failed' ) ) {
        wp_safe_redirect( $url );
        exit;
    }
}
Source by yourblogcoach.com #
 
PREVIOUS NEXT
Tagged: #redirect #woocommerce
ADD COMMENT
Topic
Name
4+2 =