{"id":9491055,"date":"2017-09-12T21:42:24","date_gmt":"2017-09-12T21:42:24","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/other-solution\/"},"modified":"2017-09-12T21:43:38","modified_gmt":"2017-09-12T21:43:38","slug":"other-solution","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/other-solution\/","title":{"rendered":"other solution"},"content":{"rendered":"<p>because this plugin not work anymone , i suggest to any wp user my solution , it&#8217;s simple code can be added in you function.php in your theme , or by code snippet plugin :<br \/>\nadd_action( &#8216;woocommerce_thankyou&#8217;, &#8216;ad_redirectcustom&#8217;);<\/p>\n<p>function ad_redirectcustom( $order_id ){<br \/>\n    global $current_user;<br \/>\n    $order = new WC_Order( $order_id );<br \/>\n    $items = $order-&gt;get_items();<br \/>\n     $product_id=223074;\/\/id of your product<br \/>\n     $product_id2=223076;\/\/ must be change by id of you product<br \/>\n  foreach ( $items as $item ) {<\/p>\n<p>    $url =&#8221;;<br \/>\n    $url2=&#8221;;<br \/>\n if (($order-&gt;status!=&#8217;failed&#8217;)&amp;&amp;(product_id==$item[&#8216;product_id&#8217;])) {<br \/>\n        wp_redirect($url);<br \/>\n        exit;<br \/>\n    }<br \/>\n else if (($order-&gt;status!=&#8217;failed&#8217;)&amp;&amp;($product_id2==$item[&#8216;product_id&#8217;])) {<br \/>\n     wp_redirect($url2);<br \/>\n     exit; \/\/<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>u can do many conditions as you want , if you don&#8217;t understand code , please give me comment in my gist : here https:\/\/gist.github.com\/AladinDridi\/442db23c731fae9d6dfb54e10f3e6014<\/p>\n","protected":false},"template":"","class_list":["post-9491055","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9491055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9491055\/revisions"}],"predecessor-version":[{"id":9491059,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9491055\/revisions\/9491059"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=9491055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}