• Resolved yolidg

    (@yolidg)


    How could I customize the confirmation email (“completed status”) to show the additional fields created in WooCommerce PDF Invoices & Packing Slips? Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @yolidg,

    The completed order email isn’t an email generated by our plugin but by WooCommerce. So if you want to edit it you will have to create a custom email template for this in your child theme.

    Also which additional fields would you like to display in the email?

    Thread Starter yolidg

    (@yolidg)

    Thanks for answering
    I would like to include the custom block fields that I created. They are shown in the pdf document of the invoice but I want to show them in the body of the email and I don’t know what code I should include in the email template of the woocomerce.
    {{additional_cog_user1}} {{additional_curs_user1}} and {{additional_vari}}
    I attached an image in the link

    Imagen

    Plugin Contributor kluver

    (@kluver)

    Hi @yolidg,

    In the WooCommerce email templates you will have access to the $order object. So you can retrieve the order meta like this:

    $order->get_meta('additional_cog_user1', true);

    Thread Starter yolidg

    (@yolidg)

    Hi
    I have written the code in the corresponding email template but it does not attach the information in the body of the email. Where should I insert the code? I’ve put it after:

    do_action (‘woocommerce_email_order_meta’, $ order, $ sent_to_admin, $ plain_text, $ email);
    $order->get_meta(‘additional_cog_user1’, true);$order->get_meta(‘additional_curs_user1’, true);

    Plugin Contributor kluver

    (@kluver)

    Hi @yolidg,

    Since this question is not related to our plugin we unfortunately can’t help you much further with this. But to get you in the right direction, the get_meta function will retrieve the data but will not output it. So you need to use it in combination with something like echo or printf().

    Looking at your example you would like to print the values side by side so I would suggest something like this:

    printf('<span>%s %s</span>', $order->get_meta( 'additional_cog_user1', true ), $order->get_meta('additional_curs_user1', true ) );

    Also make sure you create a custom email template in your child theme and add your customizations there. Else your customizations will be overwritten the next time WooCommerce updates.

    • This reply was modified 5 years, 1 month ago by kluver.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘customize the email to show the additional PDF Invoices fields’ is closed to new replies.