Created
September 12, 2017 13:22
-
-
Save AladinDridi/522da465af8299b84a20565ee8087246 to your computer and use it in GitHub Desktop.
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 ){ | |
global $current_user; | |
$order = new WC_Order( $order_id ); | |
$items = $order->get_items(); | |
$product_id=223074; | |
$product_id2=223076; | |
foreach ( $items as $item ) { | |
$url =''; | |
$url2=''; | |
if (($order->status!='failed')&&($order->payment_method =='other_payment')&&(( user_can( $current_user, "7eme")))&&($product_id==$item['product_id'])) { | |
wp_redirect($url); | |
exit; | |
} | |
else if (($order->status!='failed')&&($order->payment_method =='other_payment')&&(( user_can( $current_user, "7eme")))&&($product_id2==$item['product_id'])) { | |
wp_redirect($url2); | |
exit; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment