• because this plugin not work anymone , i suggest to any wp user my solution , it’s simple code can be added in you function.php in your theme , or by code snippet plugin :
    add_action( ‘woocommerce_thankyou’, ‘ad_redirectcustom’);

    function ad_redirectcustom( $order_id ){
    global $current_user;
    $order = new WC_Order( $order_id );
    $items = $order->get_items();
    $product_id=223074;//id of your product
    $product_id2=223076;// must be change by id of you product
    foreach ( $items as $item ) {

    $url =”;
    $url2=”;
    if (($order->status!=’failed’)&&(product_id==$item[‘product_id’])) {
    wp_redirect($url);
    exit;
    }
    else if (($order->status!=’failed’)&&($product_id2==$item[‘product_id’])) {
    wp_redirect($url2);
    exit; //
    }
    }
    }

    u can do many conditions as you want , if you don’t understand code , please give me comment in my gist : here https://gist.github.com/AladinDridi/442db23c731fae9d6dfb54e10f3e6014

    • This topic was modified 7 years, 2 months ago by aladinDr.
Viewing 1 replies (of 1 total)
  • Thank you so much for this! I do have a question though. What if I need to do this for multiple products? Do I include them as $product_id3, $product_id4 etc?

    Or does this code have to be inserted for each product and URL?

Viewing 1 replies (of 1 total)
  • The topic ‘other solution’ is closed to new replies.