Try it

Rules: how they work

Sortyra team · · 9 min read

A rule is an instruction in the form "if a condition applies, make a change", which Sortyra applies to every product each time the feed is updated. You set it up once and it also applies to products the supplier adds tomorrow. You don't need to program – you build the rule from a menu.

What rules do

Imagine a warehouse worker who goes through every delivery following a sheet of instructions: "if the brand is missing, add it", "round the price to .90". Rules are that sheet – except a computer carries them out every time the feed (the supplier's list of products) is updated.

Every rule has two parts:

  • IF – a condition that selects products (for example "stock is 0" or "manufacturer is Acme"). Without a condition, the rule applies to all products.
  • THEN – an action saying what happens to the selected products (the price changes, text is added, the product is hidden…).

Rules always belong to one output – a feed for a specific channel, such as Heureka or Google. The supplier's original data does not change; rules only adjust what leaves the output.

Where to find rules

In the left-hand menu, in the Catalogue group, click Rules. The screen always works with one output – choose it in the feed switcher in the top bar. If you don't have an output yet, the app first asks you to create one.

The screen has four tabs:

  • Rule chain – the list of the output's rules, next to it a Test run panel for the whole chain and Suggest with AI, and below it Variables – values such as a margin or exchange rate that you use in several rules,
  • Templates – ready-made sets of rules for channels, recipes and packs (in detail in the article Rule recipes – examples),
  • Test runs – the last 10 test runs of the whole chain,
  • Archive – every version of a rule, including deleted ones, with the option to restore it.

How rules are carried out

Rules are carried out from top to bottom, and each one sees the product as the previous one left it. If the first rule increases the price by 10 % and the second rounds it to .90, it is the increased price that gets rounded.

After every change to the rules, the output is recalculated by itself. Manual edits and locked fields always take priority – a rule does not change a locked field (more in the article Manual edits and locked fields).

Step by step: a new rule

  1. Open Rules and choose the output in the feed switcher in the top bar.
  2. Click New rule in the top bar (or Add a rule in the Rule chain card). The "If … then …" builder opens.
  3. In the IF part, click Add condition. Fill in the Field (for example STOCK), choose the Condition (for example ≤) and enter the Value (for example 0). If you don't add a condition, the rule applies for all products.
  4. With several conditions, choose the Condition logic: all conditions are met or at least one condition is met. If you have a saved view (filter) on the Products screen, you can use it via Use a saved view from Products…
  5. In the THEN part, choose the Action, fill in the Target field and any other details the action needs (value, expression, text to replace…).
  6. Optionally set Active from and Active until (the rule switches itself on and off – for example for a weekend promotion), For supplier (the rule applies only to products from one source) and a Rule name, so you can find it easily in the chain.
  7. Click Test run. You see how many products will change, how many will be hidden, which fields are affected, and "before → after" examples. Nothing is saved yet.
  8. If the impact is fine, click Create rule. It is added to the end of the chain and the output is recalculated.

Conditions you can use

ConditionWhen it applies
is / is notthe value matches (doesn't match) exactly; numbers are compared as numbers, so 15.0 is the same as 15
<, >, ≤, ≥comparing numbers or dates (for example 2026-12-01)
contains / does not containthe text appears (doesn't appear) anywhere in the field
starts with / ends withthe beginning or end of the text
matches regexthe text fits a regular expression (a pattern for searching text)
is filled in / is emptythe field has or doesn't have a value; no value needs to be entered
is a valid EAN / is an invalid EANthe code has (or doesn't have) the correct length and check digit

For fields with several values (for example CATEGORIES or IMAGES), it is enough for one value to meet the condition.

Actions a rule can perform

ActionWhat it does
Set valuewrites text into the field, including the value of another field, e.g. %MANUFACTURER% %NAME%
Add to beginning / Append to endadds text before or after the current value
Find and replaceswaps text; optionally as a regular expression, with the Test the expression tester
Calculationcalculates a value with a formula, e.g. PRICE_VAT * 1.1, and rounds to the chosen number of decimal places
Round to endingadjusts the price so it ends in e.g. 0.90 or 9
Value tableconverts values using a lookup list (original = new); you can also paste the table from Excel
Copy valuestransfers a value from one field or attribute to another
Letter caselowercase, UPPERCASE, Every Word Capitalised, or only the first letter capital
Truncate textshortens text to a given number of characters, on whole words
Remove HTMLremoves formatting tags from the description
UTM parametersadds visit-tracking parameters to links
Translatetranslates the chosen fields into another language (see Translations)
Generate codefills in a missing product code consistently – the same product always gets the same code
Hide productthe product does not get into the output

Write fields in capital letters exactly as in the list of fields (NAME, PRICE_VAT, EAN…). You write an attribute as PARAM:Colour. You can find out which fields and values your products have on the Fields and values screen (see Fields and values) – from there you can also create a rule with the + Rule button next to a specific value.

Examples

  • Clearance without losing money: IF STOCK ≤ 0 → Hide product – sold-out goods don't appear on the comparison site and you don't pay for pointless clicks.
  • Brand in the title: Add to beginning: NAME = %MANUFACTURER% – "Tent Trek 2" becomes "Nordwind Tent Trek 2".
  • Mark-up: Calculation: PRICE_VAT = PRICE_VAT * 1.08 – all prices in the output go up by 8 %.
  • Attractive prices: Round to ending: PRICE_VAT, 0.90 – €24.63 becomes €24.90.

You will find over 60 more examples in the article Rule recipes – examples.

Managing the rule chain

Each rule in the chain has a Rule enabled switch and arrows to change the order; you can also change the order by dragging a rule with the mouse. Under the More actions button (three dots) you'll find Edit, JSON (advanced editing), Note (why the rule exists), Duplicate, Select and Delete. A rule with a fixed period carries the label Scheduled, and a rule from AI the label Suggested by AI.

  • All, For output, For source and Scope – narrow the list down to the rules of the whole output or of a single source.
  • Search rules and Select shown (in the three-dot menu) – find rules and enable, disable, move to a group or delete them in bulk.
  • Same as #N – the app marks a rule that does exactly the same thing as an earlier one. You can disable or delete it.
  • Archive – every change has a version and an author (user, AI, API). The Restore this version button takes you back, even after deletion.
  • Export rules / Import rules (in the three-dot menu) – download rules as a file and upload them to another output. When importing, in the Import mode field you choose Add to current rules or Replace current rules.
  • Suggest with AI – you describe in a sentence what you want to change, and AI Copilot prepares a rule suggestion that you add only after reviewing it.

Tips and common mistakes

  • Order matters. Put title shortening after the rule that adds the brand to the title.
  • "is" compares exactly. For text, letter case matters (Acme is not ACME). If you are not sure how something is written, use contains, which ignores letter case.
  • Decimal point in expressions. In a calculation, write 1.1, not 1,1.
  • Percent sign in text. Text between two % characters is treated as a field name. If you want to write a percent sign itself in the text, write it twice: 20 %% off.
  • Empty field in a calculation. If a calculation hits an empty or non-numeric value, it leaves the product unchanged and flags the rule with an error. You can find such products in Products under the status With rule error. The condition PURCHASE_PRICE is filled in helps.
  • Why does a product look like this? In the product detail, switch on Track product. After the next run, the Rule trace card shows every rule that changed the product.

Frequently asked questions

Will rules overwrite my manual edits?

No. Manual edits and locked fields take priority over rules and over new data from the supplier.

Does a rule also apply to new products?

Yes. Rules are applied at every feed update, so also to products the supplier adds later.

Can I have different rules for Google and for Heureka?

Yes. Rules belong to an output, so each channel can have its own chain. You can transfer the same rules with the Export rules and Import rules buttons.

How do I undo a change that went wrong?

On the Archive tab, find the previous version of the rule and click Restore this version. The output is recalculated.

Can I describe a rule in a sentence?

Yes, with AI Copilot. You write, for example, "Hide products without an image" and Copilot prepares the rule with a test run for you to approve.

Try it on your own feed