vishalmaisuria402
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Custom checkout field in order review tableHi Morris,
I am struggling with the same issue.
Are you able to share your code with cookie which saves the field values so that it doesn’t get deleted upon the refresh/reload??
Also, i’m not a hardcore coder but i am also having issues with the code i wrote which re-routes the new order email based on the checkout add-on value(stores) selection on the checkout. The problem is that whenever the user is redirected to a payment gateway hosted payment page and after the completion of the payment it should use the code i wrote to reroute the email but due to my lack of knowledge about sessions and cookies i am not able to do it and my code fails. The code works fine with cheque payments or anything done on the same page.
Below is my code for your reference:
// Change new order email recipient for different stores
function wc_change_admin_new_order_email_recipient( $recipient, $order ) {
global $woocommerce;
$dropdownValue = $_POST[‘wc_checkout_add_ons_2’];switch($dropdownValue)
{
case “newmarket”:
$recipient = “abc@xyz.com”;
break;
case “takapuna”:
$recipient = “def@xyz.com”;
break;
}
return $recipient;
}
add_filter(‘woocommerce_email_recipient_new_order’, ‘wc_change_admin_new_order_email_recipient’, 1, 2);
//EndYour help is much appreciated.
Kind Regards,
Vishal