4. Jun 2022 |

WooCommerce – add product custom field to order email

What you need, is to use a hook and a function to modify e-mail template. That is it.

First idea probably would be changing the template. In this file: wp-content/plugins/woocommerce/templates/emails/email-order-items.php

First $product = $item->get_product(); and then $key = $product->get_meta('custom_field_key'); and then this thread was helpful but this is the hook and action were what I really needed.

Also useful:

'customer_completed_order' === $email->id and order email ids that are available.

I order to test e-mails locally Sendinblue works really well as SMTP and is simpler to set up than Sendgrid.

Leave a Reply

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