• Resolved katdidit

    (@katdidit)


    been banging my head on this for a while – I have created an extra field on a product called email_recipient and it all works wonderful, now I want to create a custom email that is sent on order proceessing hook using email_recipient if this field is present in the order meta. I thought I could do it by using the order object in the class and exploding the get_meta_data or meta_data, check for the field and if its not there, return. But I get the error that meta_data() and get_meta_data() is not a valid method for the object. I thought it would work because it works with get_shipping_method() and both are in the order object, but I am obviously barking up the wrong tree. Any ideas on how to access the fields from an email class to do this?
    I did ask this over on the woocommerce forum, but since you are the experts on the custom fields that you might have some insight or a quick answer. Thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter katdidit

    (@katdidit)

    For anyone else who has this problem, it was solved by using get_items() as key and isset.

    
    $itemeta = $this->object->get_items();
              foreach($itemeta as $key => $lineItems)		
    			if ( !isset($lineItems['recipient_email']))
    		   return;
Viewing 1 replies (of 1 total)
  • The topic ‘using custom fields in custom email class’ is closed to new replies.