Created
September 28, 2018 08:22
-
-
Save zainaali/1ef31b38129941b598c760f110e783af to your computer and use it in GitHub Desktop.
Redirect page after order is placed based on order status Woocommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_thankyou', 'bbloomer_redirectcustom'); | |
function bbloomer_redirectcustom( $order_id ){ | |
$order = new WC_Order( $order_id ); | |
$url = 'https://siteurl/thank-you-payment/'; //Thank you page | |
$mem_url = 'https://siteurl/payment-denied/'; // denied page | |
if ( $order->status == 'pending' ) { | |
wp_redirect($mem_url); | |
} | |
else{ | |
wp_redirect($url); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment