• Resolved hardedge

    (@hardedge)


    Hello,

    I’m using your plugin Checkout Field Editor for WooCommerce to add shipping email on shipping section and I used the code below that I found it here but dosent work with me. it disabled all the other emails notifcation and only new order email that enabeld and sent me crtitcal error.

    This the orginal code that I took it from here : add_filter(‘woocommerce_email_recipient_new_order’, ‘additional_email_checkout’, 10, 2); function additional_email_checkout($emails, $object){ $order_id = method_exists( $object, ‘get_id’ ) ? $object->get_id() : $object->id; $aditional_email = get_post_meta($order_id, ‘your_field_name’, true); if($aditional_email){ $emails .= ‘,’.$aditional_email; } return $emails; }

    I have amended the code above with my require to let only shipping email get the confirmation email and both of billing and shipping get email when the order is completed

    // For new orders
    add_filter(‘woocommerce_email_recipient_new_order’, ‘custom_new_order_email_recipient’, 10, 2);

    function custom_new_order_email_recipient($recipient, $order) {
    if (method_exists($order, ‘get_shipping_email’)) {
    return $order->get_shipping_email();
    }
    return $recipient;
    }

    // For completed orders
    add_filter(‘woocommerce_email_recipient_customer_completed_order’, ‘custom_completed_order_email_recipient’, 10, 2);

    function custom_completed_order_email_recipient($recipient, $order) {
    if (method_exists($order, ‘get_shipping_email’) && method_exists($order, ‘get_billing_email’)) {
    $shipping_email = $order->get_shipping_email();
    $billing_email = $order->get_billing_email();
    return $billing_email . ‘,’ . $shipping_email;
    }
    return $recipient;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Dina S.

    (@themehighsupport)

    Your requirement needs a detailed check. Can you please raise a ticket through our website? We hope our technical team will be able to help you.

    Thank you!

    Plugin Support Dina S.

    (@themehighsupport)

    Since we haven’t heard back from you, we believe that your issue is resolved.

    We are going to mark this thread as resolved.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WooCommerce Shipping Email Notifications Setup’ is closed to new replies.