• Resolved zzzt

    (@zzzt)


    Hello!

    I set up custom fields.
    Billing: https://prnt.sc/sf7e0v
    Additional: https://prnt.sc/sf7fpy

    I use a custom email template for ordering.
    The field values ​​are displayed using the following codes (2 examples):

    <? php printf (__ ('% s', 'woocommerce'), $ order-> billing_first_name); ?>
    <? php printf (__ ('% s', 'woocommerce'), $ order-> addburn); ?>

    The output of standard fields in the letter works correctly:
    <? php printf (__ ('% s', 'woocommerce'), $ order-> billing_first_name); ?>

    The output of manually created fields in the plugin does not work in the letter. For example, the additional field is not displayed:
    <? php printf (__ ('% s', 'woocommerce'), $ order-> addburn); ?>
    (the presence of the field can be checked in the screenshot above)

    I think the plugin creates additional fields with a prefix, but I’m definitely not sure.
    Please help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    All the fields created using our plugin are saved as Order Meta Data.

    You can retrieve the data from the database using the below function:

    get_post_meta($order_id, 'field_name', true);

    We hope this will help.

    Thank you!

    Thread Starter zzzt

    (@zzzt)

    Thank you, but this does not work, unfortunately.

    Let’s use the example of a comment on an order.
    Here is the field in your plugin: https://prnt.sc/sfvrne
    Field on the order page: https://prnt.sc/sfvtcz

    There is a template in my theme folder
    woocommerce / emails / admin-new-order.php

    The template has a code that should display the desired field in the letter. Here it is:

    <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
      <tbody>
        <tr>
         </tr>
        <tr>
          <td>Комментарий к заказу</td>
          <td><?php get_post_meta($order_id, 'order_comments', true); ?></td>
        </tr>
      </tbody>
    </table>

    And here is the letter that comes after the order: https://prnt.sc/sfvxsv

    Is empty
    What am I doing wrong?

    Plugin Author ThemeHigh

    (@themehigh)

    Moved to the premium support team.

    Hence marking this thread as resolved.

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Field in emails (custom template)’ is closed to new replies.