woocommerce call functions in order

I’m developing a plugin over woocommerce. I want when a order is completed some custom fields to be filled. After that I want to add those custom fields to the email sent to the client.
I have used

add_action( 'woocommerce_order_status_completed', 'myplugin_woocommerce_order_status_completed', 10, 1 );

to fill the custom fields and

add_action( 'woocommerce_email_order_meta', 'woo_add_tickets_numbers_to_email' );

to add those fields to email.

My problem seems tha woocommerce_email_order meta get fired before woocommerce_order_status_completed and the fields are empty.
How can I force to execute first woocomerce_order_status_completed and send email after that?

Best regards

Read more here: woocommerce call functions in order

Leave a Reply

Your email address will not be published. Required fields are marked *