> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.stock-sync.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# AI Liquid for Step 2: Matching Column 

AI prompts can help customise liquid mapping. You can change the liquid mapping via the AI prompt, which is currently in **Step 2: Matching Column's Smart Setting**. We will show an example of a prompt below:

### Title & Description field 

1. **Combine source data** 
Prompt: Combine source data column “brand” and column “title” with a dash
Output: `{{ data[“brand”] }} - {{ data[“title”] }}`

2. **Uppercase the first character**
Prompt: Uppercase the 1st character of the source data column “title”
Output: `{% assign t = data[“title”] | default: “” %},{{ t | slice: 0,1 | upcase }}{{ t | slice: 1 }}`

3. **Replace the word** 
Prompt: Replace the word “failure” to “success” in source data column “title”
Output: `{{ data[“title”] | replace: “failure, “success” }}`

4. **Remove all html tag**
Prompt: Remove all html tag in source data column “title”
Output: `{{ data[“title”] | strip_html }}`

5. **Replace words starting with a specific character with another word**
Prompt: Find word start with “fa”, then replace it with “success” in source data column “title”
Output: 
`{% 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 }}`

6. **Remove html tag**
Prompt: Remove html tag in source data column “title”
Output: `{{ data.title | strip_html }}`

7. **Source data field empty, use default value**
Prompt: use source data column “title”, if empty default to “No title”
Output: `{{ data.title | default: “No title” }}`

8. **Source data field empty, use another column**
Prompt: use column “title”, if blank, then use column “title2"
Output: `{% if data.title | strip %}{{ data.title }}{% else %}{{ data[“title2”] }}{% endif %}`

9. **If condition when its 1, then use another column**
Prompt: if column “type” is 1, use column “title”, else use column “sub_title”
Output: `{% assign type_num = data[“type”] | plus: 0 %}{% if type_num == 1 %}{{ data.title }}{% else %}{{ data[“sub_title”] }}{% endif %}`

10. **Description to lowercase**
Prompt: change current product description to lowercase
Output: `{ product.descriptionHtml | downcase }}`

11. **Description to uppercase**
Prompt: change current product description to uppercase
Output: `{ product.descriptionHtml | uppercase }}`
---

### Quantity Field

1. **Use a column value to update quantity** 
Prompt: If column "a" value is "HIGH", return 10, else return column "qty"
Output: `{% if data["a"] == "HIGH" %}10{% else %}{{ data["qty"] }}{% endif %}`

2. **Compare a column value** 
Prompt: If column "qty" value is less than 5, return 0, else return column "qty"
Output: `{% if data["qty"] < 5 %}0{% else %}{{ data["qty"] }}{% endif %}`

3. **Perform arithmetic using two columns**
Prompt: If column "qty" value is less than 300, return column "qty" minus column "b", else return column "qty"
Output: `{% if data["qty"] < 300 %}{{ data["qty"] | minus: data["b"] }}{% else %}{{ data["qty"] }}{% endif %}`

4. **Multiply by another column**
Prompt: If column "qty" value is less than 0, return column "qty" multiplied by column "a" (as a positive number), else return column "qty"
Output: `{% if data["qty"] < 0 %}{{ data["qty"] | times: data["a"] | abs }}{% else %}{{ data["qty"] }}{% endif %}`

5. **Use a comparison with "less than or equal to"**
Prompt: If column "qty" value is less than or equal to 30, return 5, else return column "qty"
Output: {% if data["qty"] <= 30 %}5{% else %}{{ data["qty"] }}{% endif %}

6. **Use a "greater than" comparison**
Prompt: If column "qty" value is greater than 10, return 15, else return column "qty"
Output: `{% if data["qty"] > 10 %}15{% else %}{{ data["qty"] }}{% endif %}`

7. **Use a "greater than or equal to" comparison**
Prompt: If column "qty" value is greater than or equal to 20, return 50, else return column "qty"
Output: `{% if data["qty"] >= 20 %}50{% else %}{{ data["qty"] }}{% endif %}`

8. **Use a "more than or equal to" comparison**
Prompt: if column index 5 is equal or more than 10, return column index 5 by mutiply 0.5, else return 0
Output: `{% assign val5 = data[5] | plus: 0 %} {% if val5 >= 10 %} {{ val5 | times: 0.5 }} {% else %} 0 {% endif %}`

9. **Check whether a value starts with specific text**
Prompt: If column "qty" value starts with "Incoming", return 0, else return column "qty"
Output: `{% assign qty_start = data["qty"] | slice: 0, 8 %}{% if qty_start == "Incoming" %}0{% else %}{{ data["qty"] }}{% endif %}`

10. **Check whether a value ends with specific text**
Prompt: If column "qty" value ends with "delivered", return 0, else return column "qty"
Output: `{% 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 %}`

11. **Check whether a value is within a range**
Prompt: If column "qty" value is between 20 and 50, return 20, else return column "qty"
Output: `{% if data["qty"] >= 20 and data["qty"] <= 50 %}20{% else %}{{ data["qty"] }}{% endif %}`

12. **Combine multiple conditions with AND**
Prompt: If column "a" value equals "disponible" and column "qty" is less than or equal to 0, return 1, else return column "qty"
Output: `{% if data["a"] == "disponible" and data["qty"] <= 0 %}1{% else %}{{ data["qty"] }}{% endif %}`

13. **Return a constant value**
Prompt: For all products, return 15 regardless of column "qty" value
Output: `{{ "15" }}`

13. **Divide one column by another**
Prompt: For all products, return column **qty** divided by column **a**
Output: `{{ data["qty"] | divided_by: data["a"] }}`

---

### Price, Compare at Price, & Cost Field

1. **Current variant price multiplication** 
Prompt: Current variant price multiply by 1.7
Output: `{{ variant.price | times: 1.7 }}`

2. **Column price multiplication**
Prompt: Multiply column "price" by 1.5
Output: `{{ data.price | times: 1.5 }}`

3. **Addition and Multiplication to column price**
Prompt: Add 80 to column "price", then multiply by 1.5
Output: `{{ data.price | plus: 80 | times: 1.5 }}`

4. **Percentage Discount Calculation**
Prompt: Decrease current price by column "discount", calculation is divide 100 then multiply by column "discount"
Output: `{{ data.price | minus: (data.price | times: (data["discount"] | divided_by: 100)) }}`

5. **Single Vendor Condition**
Prompt: If current product vendor is "abc", multiply column "price" by 1.5, else remain the same
Output: `{% if product.vendor == "abc" %}{{ data.price | times: 1.5 }}{% else %}{{ data.price }}{% endif %}`

6. **Multiple Vendor Conditions**
Prompt: If current product vendor is "abc", multiply column "price" by 1.5, if current product vendor is "def", multiply by 1.8, else remain the same
Output: `{% if product.vendor == "abc" %}{{ data.price | times: 1.5 }}{% elsif product.vendor == "def" %}{{ data.price | times: 1.8 }}{% else %}{{ data.price }}{% endif %}`

7. **Maximum Price Limit**
Prompt: Multiply column "DBP" by 1.10 and 1.15, if the result is higher than column "RRP", return column "RRP", else return result
Output: `{% assign result = data["DBP"] | times: 1.10 | times: 1.15 %}{% if result > data["RRP"] %}{{ data["RRP"] }}{% else %}{{ result }}{% endif %}`

8. **Current Variant Multiplication for compare at price**
Prompt: multiply current variant compare at price by 0.5
Output: `{{ variant.compareAtPrice | times: 0.5 }}`

9. **Current Variant Multiplication for cost**
Prompt: multiply current variant cost by 0.5
Output: `{{ variant.inventoryItem.cost | times: 0.5 }}`

---

### Status Field

1. **Archive when quantity is 0**
Prompt: if source quantity is 0, return archive, otherwise active
Output: `{% assign q = data.qty | plus: 0 %}{% if q <= 0 %}archived{% else %}active{% endif %}`

2. **Draft when price is under 5**
Prompt: set draft when price is under 5, else active
Output: `{% assign p = data.price | plus: 0.0 %}{% if p < 5 %}draft{% else %}active{% endif %}`

3. **Archive discontinued product**
Prompt: if the discontinued column says "yes", return archive; otherwise active
Output: `{% if data.discontinued == "yes" %}archived{% else %}active{% endif %}`

4. **Draft products with no image**
Prompt: products with no image1 should be draft, the rest active
Output: `{% if data.image1 == blank %}draft{% else %}active{% endif %}`

5. **Unlist sample products**
Prompt: if title contains "sample", return unlisted, else active
Output: `{% if data.title contains "sample" %}unlisted{% else %}active{% endif %}`

6. **Map availability values**
Prompt: map availability column: "in stock"→active, "discontinued"→archived, else draft
Output: `{% case data.availability %}{% when "in stock" %}active{% when "discontinued" %}archived{% else %}draft{% endcase %}`

7. **Active when Compare-at Price exists**
Prompt: if the "compare at price" column is filled (on sale) return active, else draft
Output: `{% if data["compare at price"] != blank %}active{% else %}draft{% endif %}`

8. **Keep archived products archived**
Prompt: keep the current product archived if it already is; otherwise active when stock exists, else draft
Output: `{% assign q = data.qty | plus: 0 %}{% if product.status == "ARCHIVED" %}archived{% elsif q > 0 %}active{% else %}draft{% endif %}`

9. **Unlist products without a brand**
Prompt: if there's no brand value, return unlisted; otherwise active
Output: `{% if data.brand == blank %}unlisted{% else %}active{% endif %}`

10. **Set status using quantity tiers**
Prompt: quantity tiers: 0→archived, under 5→draft, otherwise active
Output: `{% assign q = data.qty | plus: 0 %}{% if q == 0 %}archived{% elsif q < 5 %}draft{% else %}active{% endif %}`