Articles on: Matching Column

AI Liquid for Step 2: Matching Column

Use AI prompts in Stock Sync to automatically generate and customize Liquid mapping formulas for product titles, descriptions, pricing, inventory quantities, and product statuses.


Available on: ✔️ Add | ✔️ Update | ✔️ Export



How to Set Up Liquid Mapping with AI Prompts


Clear UI navigation path: Go to App → Feed Settings → Step 2: Matching Column


  1. Locate Mapped Field: Find the field you want to customize (e.g., Title, Description, Price, Quantity) and click the gear icon to open Smart Settings.
  2. Open AI Prompt Input: Locate the AI prompt field within the Liquid mapping settings section.
  3. Enter AI Prompt: Type your transformation instruction in plain language (e.g., Combine source data column "brand" and column "title" with a dash).
  4. Generate & Apply: Generate the Liquid code and click Save to apply the formula to your feed setup.


Make sure your source feed column names in the prompt match the exact header names in your feed file.


You can manually tweak the generated Liquid code in Smart Settings after the AI generates the initial logic.



Liquid AI Prompts Detailed Breakdown


1. Title & Description Field

Customise product titles and HTML descriptions using string transformations, conditions, and default values.


Prompt Example

Generated Liquid Code Output

Combine source data column "brand" and column "title" with a dash

{{ data["brand"] }} - {{ data["title"] }}

Uppercase the 1st character of the source data column "title"

{% assign t = data["title"] | default: "" %}{{ t | slice: 0,1 | upcase }}{{ t | slice: 1 }}

Replace the word "failure" to "success" in source data column "title"

{{ data["title"] | replace: "failure", "success" }}

Remove all html tag in source data column "title"

{{ data["title"] | strip_html }}

Find word start with "fa", then replace it with "success" in source data column "title"

{% assign transformed_title = "" %}{% for w in data.title | split: " " %}{% assign first_two = w | downcase | slice: 0,2 %}{% if first_two == "fa" %}{% assign transformed_title = transformed_title | append: "success" %}{% else %}{% assign transformed_title = transformed_title | append: w %}{% endif %}{% unless forloop.last %}{% assign transformed_title = transformed_title | append: " " %}{% endunless %}{% endfor %}{{ transformed_title }}

Remove html tag in source data column "title"

{{ data.title | strip_html }}

Use source data column "title", if empty default to "No title"

{{ data.title | default: "No title" }}

Use column "title", if blank, then use column "title2"

{% if data.title | strip %}{{ data.title }}{% else %}{{ data["title2"] }}{% endif %}

If column "type" is 1, use column "title", else use column "sub_title"

{% assign type_num = data["type"] | plus: 0 %}{% if type_num == 1 %}{{ data.title }}{% else %}{{ data["sub_title"] }}{% endif %}

Change current product description to lowercase

{{ product.descriptionHtml | downcase }}

Change current product description to uppercase

{{ product.descriptionHtml | upcase }}


2. Quantity Field

Calculate stock quantities based on logic rules, string prefixes, range comparisons, or multi-column arithmetic.


Prompt Example

Generated Liquid Code Output

If column "a" value is "HIGH", return 10, else return column "qty"

{% if data["a"] == "HIGH" %}10{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value is less than 5, return 0, else return column "qty"

{% if data["qty"] < 5 %}0{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value is less than 300, return column "qty" minus column "b", else return column "qty"

{% if data["qty"] < 300 %}{{ data["qty"] | minus: data["b"] }}{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value is less than 0, return column "qty" multiplied by column "a" (as a positive number), else return column "qty"

{% if data["qty"] < 0 %}{{ data["qty"] | times: data["a"] | abs }}{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value is less than or equal to 30, return 5, else return column "qty"

{% if data["qty"] <= 30 %}5{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value is greater than 10, return 15, else return column "qty"

{% if data["qty"] > 10 %}15{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value is greater than or equal to 20, return 50, else return column "qty"

{% if data["qty"] >= 20 %}50{% else %}{{ data["qty"] }}{% endif %}

If column index 5 is equal or more than 10, return column index 5 by multiply 0.5, else return 0

{% assign val5 = data[5] | plus: 0 %}{% if val5 >= 10 %}{{ val5 | times: 0.5 }}{% else %}0{% endif %}

If column "qty" value starts with "Incoming", return 0, else return column "qty"

{% assign qty_start = data["qty"] | slice: 0, 8 %}{% if qty_start == "Incoming" %}0{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value ends with "delivered", return 0, else return column "qty"

{% assign qty_len = data["qty"] | size %}{% assign start_pos = qty_len | minus: 9 %}{% assign qty_end = data["qty"] | slice: start_pos, 9 %}{% if qty_end == "delivered" %}0{% else %}{{ data["qty"] }}{% endif %}

If column "qty" value is between 20 and 50, return 20, else return column "qty"

{% if data["qty"] >= 20 and data["qty"] <= 50 %}20{% else %}{{ data["qty"] }}{% endif %}

If column "a" value equals "disponible" and column "qty" is less than or equal to 0, return 1, else return column "qty"

{% if data["a"] == "disponible" and data["qty"] <= 0 %}1{% else %}{{ data["qty"] }}{% endif %}

For all products, return 15 regardless of column "qty" value

{{ "15" }}

For all products, return column qty divided by column a

{{ data["qty"] | divided_by: data["a"] }}


3. Price, Compare at Price, & Cost Field

Apply multiplication multipliers, percentage discounts, vendor-based price conditions, or maximum price caps.


Prompt Example

Generated Liquid Code Output

Current variant price multiplied by 1.7

{{ variant.price | times: 1.7 }}

Multiply column "price" by 1.5

{{ data.price | times: 1.5 }}

Add 80 to column "price", then multiply by 1.5

{{ data.price | plus: 80 | times: 1.5 }}

Decrease current price by column "discount", calculation is divide by 100, then multiply by column "discount"

{{ data.price | minus: (data.price | times: (data["discount"] | divided_by: 100)) }}

If the current product vendor is "abc", multiply column "price" by 1.5, keep it the same

{% if product.vendor == "abc" %}{{ data.price | times: 1.5 }}{% else %}{{ data.price }}{% endif %}

If the current product vendor is "abc", multiply column "price" by 1.5, if the current product vendor is "def", multiply by 1.8, else remain the same

{% if product.vendor == "abc" %}{{ data.price | times: 1.5 }}{% elsif product.vendor == "def" %}{{ data.price | times: 1.8 }}{% else %}{{ data.price }}{% endif %}

Multiply column "DBP" by 1.10 and 1.15, if the result is higher than column "RRP", return column "RRP", else return the result

{% assign result = data["DBP"] | times: 1.10 | times: 1.15 %}{% if result > data["RRP"] %}{{ data["RRP"] }}{% else %}{{ result }}{% endif %}

Multiply the current variant compare at price by 0.5

{{ variant.compareAtPrice | times: 0.5 }}

Multiply current variant cost by 0.5

{{ variant.inventoryItem.cost | times: 0.5 }}


4. Status Field

Automatically control product statuses (active, draft, archived, unlisted) based on inventory levels, prices, or vendor tags.


Prompt Example

Generated Liquid Code Output

If source quantity is 0, return archive; otherwise active

{% assign q = data.qty | plus: 0 %}{% if q <= 0 %}archived{% else %}active{% endif %}

Set draft when price is under 5, else active

{% assign p = data.price | plus: 0.0 %}{% if p < 5 %}draft{% else %}active{% endif %}

If the discontinued column says "yes", return archive; otherwise active

{% if data.discontinued == "yes" %}archived{% else %}active{% endif %}

Products with no image1 should be draft, the rest active

{% if data.image1 == blank %}draft{% else %}active{% endif %}

If title contains "sample", return unlisted, else active

{% if data.title contains "sample" %}unlisted{% else %}active{% endif %}

Map availability column: "in stock"→active, "discontinued"→archived, else draft

{% case data.availability %}{% when "in stock" %}active{% when "discontinued" %}archived{% else %}draft{% endcase %}

If the "compare at price" column is filled (on sale) return active, else draft

{% if data["compare at price"] != blank %}active{% else %}draft{% endif %}

Keep the current product archived if it already is; otherwise active when stock exists, else draft

{% assign q = data.qty | plus: 0 %}{% if product.status == "ARCHIVED" %}archived{% elsif q > 0 %}active{% else %}draft{% endif %}

If there's no brand value, return unlisted; otherwise active

{% if data.brand == blank %}unlisted{% else %}active{% endif %}

Quantity tiers: 0→archived, under 5→draft, otherwise active

{% assign q = data.qty | plus: 0 %}{% if q == 0 %}archived{% elsif q < 5 %}draft{% else %}active{% endif %}



Key Rules & Technical Details


  • Object References: Use data["column_name"] or data.column_name to reference raw feed data, product.property for existing store product fields, and variant.property for variant properties.
  • Data Type Casting: When performing numerical comparisons on string columns, cast the string to a number first using | plus: 0 or | plus: 0.0.
  • Status Capitalization Requirements: Output status strings in lowercase (active, draft, archived, unlisted) to prevent Shopify catalog status errors.



Troubleshooting Steps


  • Issue: The AI-generated code produces a syntax error → Solution: Check that column headers in your AI prompt match the exact column names in your feed file, including capitalization.
  • Issue: Numerical liquid filters (like times or minus) return zero → Solution: Ensure the source feed column is cast to a number before running math filters ({% assign val = data["col_name"] | plus: 0 %}).



Good Articles to Continue


Updated on: 15/10/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!