Dynamic Metafields

The Smart app allows creating highlights (or badges) that display the value of any product metafield created by other apps.

The product metafields can be displayed by adding the {{smarthm.namespace.key}} dynamic data field in the highlight text. Here, namespace.key needs to be replaced with the actual metafield namespace and metafield key names.

Step-by-Step Instructions

Step 1: Open Smart App

  1. From Shopify admin, click Apps.
  2. Open Smart App.

Screenshot 1

Step 2: Configure Dynamic Metafields

  1. For example, if you have a metafield with the namespace 'instructions' and key 'wash ', then to display the value of this metafield, add text {{smarthm.instructions.wash}}.
  2. You can combine Product Metafield Display Conditions with Dynamic Metafields to create powerful rules that display metafield data based on your rules.
  3. Below are a few examples of product metafield representations that may be helpful.

Metafield Type

Product Metafield Representation

Product

{{ smarthm.custom.product.value }}

Collection

{{ smarthm.custom.collection.value }}

Money 

{{ smarthm.custom.price.value | money }}

Single Line Text

{{ smarthm.custom.stock.value }}

Multi Line Text

{{ smarthm.custom.specs.value | newline_to_br }}

Metafield Type

Product Metafield Representation

Rich text

{{ smarthm.custom.rich_text | metafield_tag }}

Multi-line text 

{{ smarthm.custom.alphanumeric.value }}

Validations

{{ smarthm.custom.validation.value }}

Weight

{{ smarthm.custom.product_weight.value }}

Volume

{{ smarthm.custom.volume.value }}

Metafield Type

Product Metafield Representation

Dimension

{{ smarthm.custom.dimension.value }}

Decimal 

{{ smarthm.custom.price_in_decimal.value }}

Integer List

{{ smarthm.custom.agelist.value | join:'<br>' }}

Integer Single

{{ smarthm.custom.age.value }}

Single Line Text (list) 

{{ smarthm.custom.specifications_of_product.value | join:'<br>' }}

Metafield Type

Product Metafield Representation

File

<a target='_blank' href='{{ smarthm.custom.file.value.url}}'>{{ smarthm.custom.file.value.url | split: '/' | last | split:'?' | first }}</a>

Date and Time

{{ smarthm.custom.datetimesingle.value | date: '%A, %B %d, %Y at %l:%M %p %Z' }}


Screenshot 2

Step 3: Save and Publish

  1. Review the preview panel.
  2. Click Save & Publish.

Expected Result

Dynamic Metafield appears on eligible product pages based on your rules and theme setup.

Note:

  • Dynamic Metafields are available for Pro Plan and above users only.
  • If the account is downgraded after adding Highlights with Dynamic Metafields, then those Highlights will stop being displayed.

Email [email protected] if you need free integration assistance.

Related Articles