codeHow to use actions (THEN) in rules

Rules follow a basic logic to allow you to automatically manage and modify your items: “IF the items meet X criteria, THEN do Y”.

The action you choose (the THEN part of your rule) decides how your rule affects the items filtered in the conditions (IF).

You can use actions to make changes in text fields, make changes to whole items, and do complex calculations using fields with numbers.

For example, to exclude all items from your export channel that are missing a title, you can set up your action like this:

  • IF the title field is empty (condition)

  • THEN take all fields and exclude

Extend an action with ‘AND’

You can extend actions using AND to make multiple changes to the items that you have filtered.

Example: Change the content in the condition and brand fields

To make changes to both the condition and brand fields of the items that you have filtered, set up your actions like this:

  • IF all (condition)

  • THEN take condition and set to value "new"

  • AND take brand and set to value ‘Channable’

Extend an action with ‘ELSE’

You can extend actions using ELSE to make changes to items not filtered by your IF condition.

Example: Free shipping for items over $50

To filter items that have a price of more than 50 and set their shipping price to 0:

  • IF price is greater than ‘50’ (condition)

  • THEN take shipping_price and set to value ‘0’

To set a shipping cost for all items below $50, use ELSE to set up a follow-up action:

  • ELSE take shipping_price and set to value ‘3.99’

Action types

Build item group

The Build item group action builds lists based on a group identifier, such as group ID. You can use this action to create consolidated lists.

Example: Combine brand and color fields by item group id

  • IF all

  • THEN take item_group_id and build item group

    • Of field brand and store in brand_list

    • Of field color and store in color_list

id

item_group_id

brand

color

brand_list

color_list

1

1

Nike

White

Nike, Adidas, Puma

White, Purple, Yellow

2

1

Adidas

Purple

Nike, Adidas, Puma

White, Purple, Yellow

3

1

Puma

Yellow

Nike, Adidas, Puma

White, Purple, Yellow

2

New Balance

Beige

New Balance, Vans

Beige, Black

2

Vans

Black

New Balance, Vans

Beige, Black

3

Crocs

Green

Crocs

Green

Channable will place brands with the same item_group_id into brand_list, and every color with the same item_group_id into color_list.

Calculate

The Calculate action makes calculations using number fields. You can use this action to increase or decrease the prices of your products.

Operations supported:

  • multiply by

  • divide by

  • plus

  • minus

  • multiply by field

  • divide by field

  • plus field

  • minus field

Example: Apply a 20% off sale price to all items

  • IF all

  • THEN take sales_price and multiply by “0.8”.

Calculate formula

The Calculate formula action performs more complex calculations. You can use arithmetic operations such as +, -, * and / and project fields to make calculations.

Use parentheses () to control the order of the calculations.

Example: Apply a 20% off sale price to all items

  • IF all

  • THEN take (price - sale_price)/

Copy value

The Copy value action copies the value (the text or number in a field) from one field to another. You can use it to take content from other fields and fill product fields with missing information.

Example:

  • IF sale_price is empty

  • THEN take sales_price and copy value from price.

Deduplicate items

The Deduplicate items action identifies duplicate values. You can use it to exclude items with the same content, or selectively advertise one variant of the same product.

Example: Exclude items with duplicate identifiers

If we have this data:

id

title

123

Nike Air Max sneaker

123

Adidas Classic sneaker

654

New Balance sneaker

And we apply this rule:

  • IF all

  • THEN take id and deduplicate items exclude duplicates

Both the 'Nike Air Max' and the 'Adidas Classic' are excluded, because they have the same id.

Example: Exclude higher-priced versions of the same product id

  • IF all

  • THEN take id and deduplicate items

    • Keep lowest of field price.

Deduplicate list

The Deduplicate list action identifies duplicate values in a list. You can use it to exclude items with the same content.

Example: Remove duplicates from a list of images

  • IF all

  • THEN take images_without_duplicates and duplicate list

Exclude

The Exclude action excludes items from the product data you send to your chosen channel. You can use this action to exclude items that are out of stock.

Example: Exclude items that are out of stock

  • IF stock is empty

    • OR stock is less than 0

  • THEN take all and exclude

Modify text

The Modify text action changes the formatting of a text field. You can use this action to make your title fields lowercase or capitalize the first letter to be consistent or to meet the requirements of your chosen export channel.

Options:

  • capitalize only first character

  • capitalize first character per word

  • capitalize first character per sentence

  • lowercase all words

  • uppercase all words

  • remove all non-numeric characters

  • remove digits

  • remove linebreaks

  • strip HTML from text

Example: Capitalize the first letter of all titles

  • IF all

  • THEN take title and modify text capitalize only first character

Reformat number

The Reformat number action changes the format or structure of a number field in your data. You can use it to make your pricing clearer to customers.

Options:

  • Decimal separator

  • Thousands separator

  • Number of decimals

Example: Change the price formatting from 9000,00 to 9,000.00

  • IF all

  • THEN take price and reformat number

    • Decimal separator .

    • Thousands separator ,

    • Number of decimals 2 decimals

Replace value

The Replace value action replaces a value in a field with a value of your choice. You can use it to remove the text you don’t need or to change values in your data. You may choose to use this action to change the URLS of your products from Dutch to German (‘.nl to .de’).

Example: Change URLs used in the Netherlands for the German market

  • IF all

  • THEN take URL and replace value

    • .nl replace with .de

Search for value

The Search for value action searches for specific text or numbers (values) within a field to fill your chosen field. You can also use it to replace values that you search for with another value.

Example: Use description to populate items with an empty color field

  • IF color is empty

  • THEN take color and search for value in description

    • Search value: 1 “red” 2 “yellow” 3 “pink” 4 “green”

Note: Channable does not automatically fill in all possible color values. Be sure to check products that are missing a color and include those colors in your list.

Set to value

The Set to value action edits or adds information to your field. You may choose to use this action to add a value to a new field that you need.

Example: Indicating if an item is out of stock

  • IF stock is empty

    • OR stock is less than or equal to 0

  • THEN take availability and set to value “out_of_stock”

Split items

The Split items action creates separate items based on each different value in the listing. It’s useful when you want to make separate listings for a product based on one element (for example, color or size).

Tip: If your values are not in a list yet, use the "split text to list" rule to create a list inside that field.

Example: Split products based on size

  • IF all

  • THEN take size and split items

Example: Split boots based on size

  • IF category contains boots

  • THEN take size and split items

circle-info

Tip: This action does the opposite of the action .

Last updated

Was this helpful?