Skip to main content

Dynamic Expressions

The dynamic expression is a user-defined liquid code that must return a string value.

Steps

1. Create a new dynamic expression

  • In the store admin panel, navigate to Dynamic Expressions > Create New

2. Set the name and identifier

Configure identifiers for this dynamic condition:

  • Set Name. Briefly describe the purpose of this dynamic condition.
  • Set Unique identifier. You will be using it to access the condition in the feed.
Unique identifier usage example

Unique identifier can be any string that consists of ASCII symbols and letters without spaces. When calling it in the feed append the attr_ before the unique identifier name. Use it as follows: {{ product.attr_unique_identifier }} or {{ variant.attr_unique_identifier }}.

For example, if the unique identifier is google_gender, then call it in the feed as {{ product.attr_google_gender }} or {{ variant.attr_google_gender }}.

  • Check Active to enable expression.

3. Configure Liquid expression

Write a Liquid code piece to be executed when the dynamic expression is called in the feed template.

Dynamic expression example

For example, your store has no gender column, but it is required by the marketplace the feed is generated for. The code below outputs an individual tag for the gender the product is intended for.

{%- if variant.title contains 'Women' or variant.body_html contains 'Women' -%}
female
{%- else variant.title contains ' Men' or variant.body_html contains 'Men' -%}
male
{%- else %}
unisex
{% endif -%}

4. Validate and preview expression results

  • Press Results validation to see the output preview for this specific dynamic expression.