Site logo

Archived topic

Redirect woocommerce

2 replies · Started by Gabriel on September 18, 2017

Viewing posts 1–3 of 3

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;
}
}

});

I am inserting this code in the functions.php

Hi there,

I'm not familiar with that hook - have you checked with WooCommerce support?

This archived topic is closed to new replies.