• Resolved faisal95bd

    (@faisal95bd)


    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 code

    add_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' }} screenshot

    But the email isn’t sending to that id. May be I’m writing something wrong in the “To” field. Please help…

    [ Please do not bump. ]

    • This topic was modified 3 years, 6 months ago by faisal95bd.
    • This topic was modified 3 years, 5 months ago by Jan Dembowski.
Viewing 1 replies (of 1 total)
  • Plugin Contributor Bartek

    (@bartj)

    Hello @faisal95bd !

    Unfortunately, you try to send an email with placeholder that doesn’t exist. The list of available placeholders is on the right sidebar in automation editing.

    At last, you can create the placeholder you need, by following our guide.

    If you’d like to see it in our plugin, don’t hesitate to suggest your idea!

    Have a great day!

Viewing 1 replies (of 1 total)
  • The topic ‘Send Email to Specific Shipping Zone Manager’ is closed to new replies.