Hello
I am trying to redirect my webpage to two URLs based on the current url when the checkout process is finished (thank you page based on current language). I currently have this code but it always redirects to the first URL:
add_action( ‘woocommerce_thankyou’, function(){
$currentpage = $_SERVER[‘REQUEST_URI’];
$indexpage = “/en/checkouten/”;
global $woocommerce;
$order = new WC_Order();
if ( $order->status != ‘failed’ ) {
if($indexpage==$currentpage){
wp_redirect( ‘http://www.meicosolar.com/en/’ ); exit;
} elseif($indexpage!==$currentpage){
wp_redirect( ‘http://www.meicosolar.com/’ ); exit;
}
}
});