codeHow to use conditions (IF) in rules

You use conditions, the IF part of a rule, to filter out specific items in your import data that you want to alter or affect with an action, the THEN part of a rule.

For example, to filter any items that are missing a title in the title field, you can set up your condition like this:

  • IF the title field is empty

Once you’ve set up your conditions, you can use actions to define what you want your rule to do to the items you have filtered.

Combine multiple conditions with ‘AND’

You can use AND to combine multiple conditions that items need to meet to be included in your selection.

Example: Filter items without a title and ID

  • IF the title field is empty

  • AND the id field is empty

Example: Filter items that are size small and pink

  • IF the color field is equal to ‘pink’

  • AND the size field is equal to ‘small’

Use ‘OR’ to apply rules when any specified conditions are met

You can use OR to filter and apply a rule to items that meet one or more parts of your criteria.

To do this, select OR and set up your second condition. This will filter items if they meet either the first or the second criteria.

Example: Filter items that are size large or are pink

  • IF the color field is equal to ‘pink’

  • OR the size field is equal to ‘large’

Combine ‘OR’ and ‘AND’ to make complex conditions

You can combine both OR and AND statements to make complex conditions.

Example: Filter items that are either blue or pink, and size small

  • IF the color field is equal to ‘pink’

  • OR the color field is equal to ‘blue’

  • AND the size field is equal to ‘small’

There is a hierarchy that determines how OR conditions can affect your other conditions. Each OR has an effect on the IF or AND condition that is directly before it.

If you set up these conditions:

  • IF the color field is equal to ‘pink’

  • AND the size field is equal to ‘small’

  • OR the size field is equal to ‘medium’

The OR condition will only affect the AND condition before it.

circle-info

Note: When you save your rule, you can see how many items are being filtered by your conditions in the panel above your rule.

Once you have set up your conditions, you can add actions (THEN-statements) to continue building your rule.

Apply a rule to all of your items

To include all your items in a rule, use the condition all. In this situation, you don’t need to use ‘OR’ or ‘AND’ conditions. Instead, you can set your condition up like this:

  • IF all

Next, you need to add an action to complete the rule. Once you save your rule, all items will be affected by your rule.

Condition types

All

The All condition selects all items from your import data. You can use this condition to select all your items to make the same change to all of your items.

Example:

  • IF all

Contains any of

The Contains any of condition filters items that contain specified values in a field. You can use this condition to search for values in other fields.

Example:

  • IF description contains any of

    • sneaker

    • shoe

    • trainer

Equals any of

The Equals any of condition filters items that contain specified values that are exact matches in a field. You can use this condition to search for exact matches on values in other fields.

Example:

  • IF GTIN equals any of

    • 4006381333931

    • 5901234567890

    • 7622305678195

Is before

The Is before condition requires the current date to be before a specified date and time to make changes to a field. You can use this condition for setting up sale pricing.

circle-info

Note: This condition can only be used with the ‘Internal field’ current_date.

Example:

  • IF current_date is before date

Is empty

The Is empty condition filters fields with missing data. You can use it to check if any of your products are missing a required field (for example, title, description).

Example:

  • IF title is empty

Is less or equal to

The Is less or equal to condition filters items with a field that contains a numerical value that is smaller or equal to a specified value.

Note: This condition should only be used with 'number' fields.

Example:

  • IF price is less or equal to

Is less than

The Is less than condition filters items with a field that contains a numerical value that is smaller than a specified value.

Note: This condition should only be used with 'number' fields.

Example:

  • IF price is less than

Is not valid

The Is not valid condition filters items with an invalid value in the GTIN or EAN field.

Note: This condition can only be used with GTIN and EAN fields.

Example:

  • IF GTIN Is not valid

Is on or after

The Is on or after condition requires the current date to be on or after a specified date and time to change a field. You can use this condition for setting up sale pricing.

Note: This condition can only be used with the ‘Internal field’ current_date.

Example:

  • IF current_date is on or after date

Last updated

Was this helpful?