Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Support request] Redirect woocommerce

Home Forums Support Redirect woocommerce

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #387669
    Gabriel

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

    });

    GP Premium 1.4.3
    #387670
    Gabriel

    I am inserting this code in the functions.php

    #387751
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I’m not familiar with that hook – have you checked with WooCommerce support?

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.