• Resolved wasimsama

    (@wasimsama)


    We have a product with PPOM fields, I want to send the same order notification as customer received to the email addresses which is entered on the filed on the product page.

    I found the following code which sends the processing email to the given email address:
    function add_another_email_recipients($recipient, $object) {
    $recipient = $recipient . ‘, [email protected]’;
    return $recipient;
    }
    add_filter( ‘woocommerce_email_recipient_customer_processing_order’, ‘add_another_email_recipients’, 10, 2);

    But, I don’t know how to replace the email “[email protected]” with the PPOM email field value.

    Can anyone help me with this?

    • This topic was modified 5 years, 11 months ago by wasimsama.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi @wasimsama,

    you can extract any PPOM Fields from order using the following code if you know the $order

    For example your PPOM email field name (dataname) is: your_email

    
    $your_email = '';
    foreach ($order->get_items() as $order_item) {
    		
    		// ppom_pa($order_item);
    		$item_meta = $order_item->get_meta('_ppom_fields');
                    $your_email = isset($item_meta['fields']['your_email']) ? $item_meta['fields']['your_email'] : '';
    }
    • This reply was modified 5 years, 11 months ago by N-Media.
    • This reply was modified 5 years, 11 months ago by N-Media.
Viewing 1 replies (of 1 total)
  • The topic ‘How to send order notification to the email address entered in the field’ is closed to new replies.