Send Email to Specific Shipping Zone Manager
-
Hi, I’ve multiple shipping zones in my shop. screenshot
Now, I want to send an automatic email to the specific shipping zone’s email with the order details. In my functions.php file, I’ve the code for it and that seems okay.
see the codeadd_action('woocommerce_order_status_processing', 'mysite_shippingzonemeta', 9, 1); function mysite_shippingzonemeta($order_id) { $order = new WC_Order($order_id); $allShippingItems = $order->get_items('shipping'); $shipping = reset($allShippingItems); $instance_id = (int)$shipping->get_instance_id(); $shippingZone = WC_Shipping_Zones::get_zone_by('instance_id', $instance_id); $parts = explode(',', $shippingZone->get_zone_name()); add_post_meta($order_id, '_shipping_zone_name', $parts[0], true); add_post_meta($order_id, '_shipping_zone_manager', $parts[1], true); add_post_meta($order_id, '_shipping_zone_manager_email', $parts[2], true); }
Now, from ShopMagic -> Automations -> I’ve added a new event: “Order Processing” with the option: “Send Email”.
The “To” field is{{ customfield | field: '_shipping_zone_manager_email' }}
screenshotBut the email isn’t sending to that id. May be I’m writing something wrong in the “To” field. Please help…
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Send Email to Specific Shipping Zone Manager’ is closed to new replies.