Spark Email Editor Knowledgebase
  • Getting Started
    • Installation
    • License Key Validation
  • TEMPLATE CUSTOMIZATION
    • Introduction
    • Create a Template
      • Enable/Disable Templates
      • Edit/Delete Templates
      • Copy/Export Template
      • Reset Templates
    • Customization of Template
      • Add background color to the Email Templates
      • Add Header and Footer in Email Templates
      • Supported Shortcodes
      • Meta data
      • To Show the Product Image in the Emails
      • Override the Order summary block
      • Preview and Test Email Templates
  • Settings
    • Adding custom CSS
    • HTML content in Email
  • Translation
    • Translate Spark Email Editor using Loco Translate
  • Addons
    • WPLoyalty
    • Woocommerce Bookings
    • Woocommerce Subscriptions
    • Woocommerce Appointments
    • Woocommerce Order Status Manager
    • Woocommerce Custom Order Status Manager
    • Germanized for woocommerce
    • Back-In-Stock Notifications
    • PW Gift Cards
    • YITH Request a Quote
    • Conditional Logics
    • TeraWallet
    • Woocommerce Memberships
  • Dokan Multi - Vendor
  • YITH Woocommerce Gift Cards
  • Yith WooCommerce Booking and Appointment.
  • Colissimo Shipping Methods
Powered by GitBook
On this page
  1. TEMPLATE CUSTOMIZATION
  2. Customization of Template

Meta data

Learn how to fetch order meta in your email templates using the Spark Editor

PreviousSupported ShortcodesNextTo Show the Product Image in the Emails

Last updated 6 months ago

WooCommerce stores extra order details in the Post Meta table using a key-value format.

Although Spark Editor supports all default order values, you might have additional data from plugins or custom fields. For instance, the Shipment Tracking ID could be a custom field.

Below is a screenshot of such a custom field.

WooCommerce allows adding additional values to every order using the "Custom Fields" section.

This custom field usually gets saved in the wp_postmeta table as a meta_key and meta_value

In the above example,

meta_key = tracking_id (it is always good to use an underscore instead of spaces) meta_value = 123456

Similarly, most shipment tracking id plugins save the data to the order (post) meta table. You can easily cross-check with the developer of the plugin to know where they save the data. It would most probably in the order meta (post meta) table.

Also, you can add your own custom data as order values. WooCommerce allows "Adding Custom Field" in every order and save as order meta

Or if you have created any additional custom fields in your orders, you can easily add the information to your emails by just adding a shortcode.

Step 1: Make sure you created the custom field or get the existing field's key

Go to your WordPress dashboard -> WooCommerce -> Orders

Open an order and scroll to the bottom of the record.

You will see both existing Meta Name/Key and their values for the order.

You can also create new value for the order by click "Enter New" link

NOTE: Once created, this Meta Name / Key will be available in the "Select list" in all other orders. So you can simply select and just enter the values. Save.

Step 2: How to fetch this order meta in email template

Just go to your WooCommerce -> Spark Editor -> Edit the Email Template where you wanted to include the order meta

Add a short code in the following format: {{order_meta.your_meta_key}}

In our example, it will be: {{order_meta.tracking_id}}