*.meta placeholders — Display custom field values#
ShopMagic’s *.meta placeholders let you insert metadata values into fields that support placeholders, such as an email subject or message.
Each placeholder reads metadata from the object provided by the automation’s event, such as an order, product, subscription, membership, or booking. It cannot retrieve arbitrary data from any object in your store.
What is metadata?#
Metadata is additional information associated with an object. For example, a plugin might save a delivery reference as an order custom field or a colour description as product metadata.
Each metadata entry has a key identifying the field and a value containing its data. To display that value, you need the exact key.
Storage depends on the object and your store’s configuration. Do not assume that all WooCommerce order data is stored in the WordPress wp_postmeta table.
How to use a meta placeholder#
Provide the metadata key using the required key parameter:
{{ order.meta | key: '_delivery_reference' }}
If the current order contains a custom field named _delivery_reference with the value DEL-12345, the placeholder displays DEL-12345.
- Choose an event that provides the relevant object.
- Select the appropriate meta placeholder in the automation editor.
- Enter the exact metadata key.
- Copy the generated placeholder into a supported field.
- Test it with an object containing that custom field.
Keys beginning with an underscore#
A leading underscore is part of the key. For example, _delivery_reference and delivery_reference are different keys.
WordPress commonly treats keys beginning with an underscore as protected metadata, which affects their visibility in standard custom-field interfaces. This does not automatically prevent ShopMagic from reading them.
Available meta placeholders#
| Placeholder | Data source | Availability |
|---|---|---|
{{ order.meta | key: '_delivery_reference' }} |
The current order | ShopMagic core |
{{ product.meta | key: '_product_color' }} |
The current product | ShopMagic core; see the version limitation below |
{{ subscription.meta | key: '_custom_reference' }} |
The current subscription | ShopMagic for WooCommerce Subscriptions |
{{ membership.meta | key: '_custom_reference' }} |
The current user membership | ShopMagic for WooCommerce Memberships |
{{ booking.meta | key: '_custom_reference' }} |
The current booking | ShopMagic for WooCommerce Bookings |
The keys above are examples. Replace them with keys that exist on the relevant object. Integration placeholders require the corresponding ShopMagic add-on and WooCommerce extension to be active.
Product metadata limitation in ShopMagic 4.9.3: The
product.metaimplementation does not correctly use the current product’s ID when reading its metadata. It can return an empty result even when the field exists. For variations, it may read the field from the parent product instead. Verify this behaviour before relying on the placeholder.
Use dedicated placeholders for standard fields#
If ShopMagic provides a dedicated placeholder for a standard field, use it instead of trying to retrieve its underlying metadata. For example:
{{ order.billing_email }}
This is preferable to using order.meta with _billing_email. Standard WooCommerce properties are not always exposed as custom metadata, and their storage can vary.
Supported values and limitations#
Meta placeholders are intended for simple values that can be displayed as text, such as a delivery reference, a number, or a short description.
- Missing data: If the required object or metadata value is unavailable, the placeholder normally displays no content.
- Arrays and objects: These placeholders do not select nested values or format complex structures. They may produce warnings or unusable output when given arrays or objects.
- Formatting: Values are not automatically formatted as dates, prices, or readable field labels.
- Order-item metadata:
order.metareads metadata belonging to the order itself, not custom fields attached to individual line items. - Multiple products:
product.metarequires product data from the event. It does not automatically loop through every product in an order.
For example, a field containing the following array cannot be used to display only its phone value through the standard key parameter:
[
'name' => 'John Smith',
'phone' => '123123123',
]
Use a custom placeholder or store the required value in a separate, simple custom field when additional processing is needed.
Finding the correct metadata key#
Start with the documentation or code of the plugin that saves the field. A field’s visible label is not necessarily its metadata key.
If you created the custom field yourself, use the exact key from your code. If another plugin created it, check:
- Which object owns the field: an order, product, user, membership, subscription, booking, or order item.
- The exact key, including any leading underscore.
- Whether the value is simple text or a complex structure requiring processing.
- Whether the plugin stores the value as metadata at all.
If database inspection is necessary, use the object’s ID and the correct storage location for your installation. Database table prefixes may differ from wp_.
Troubleshooting empty output#
- Check the placeholder name and the spelling of the
keyparameter. - Confirm that the event provides the required object.
- Confirm that the custom field exists on the specific object used in the automation.
- Check that the value is not stored on a related object, such as an order item or membership plan.
- Check whether the value requires special processing by the plugin that created it.
- For
product.meta, review the ShopMagic 4.9.3 limitation described above.
