Skip to main content

Rules - Advanced examples

Updated this week

After learning the basic principles of the Attribute Rules editor, you can start building more advanced rules to customise how your product data is exported. The examples below show several common advanced rules scenarios.

Add size system suffix by brand

◉ In this case, we add a size system suffix (EU, IT, US, UK) to the exported size value, based on the item’s brand. The size is determined by checking multiple size attributes.

Combine (Use) multiple attributes as input for the Rule

  • Size - sample attribute values: 10, 12, XL, S, 36

  • Taglia - sample attribute values: 38, 44, 42

Define the following operations:

  • Default Rule: Combine Size & Taglia attributes and use the *take first non-empty item as text operation. Essentially, we check multiple attributes per sort order (Combine), in this case, Size & Taglia to use the first one that contains a value.

  • Conditional Rule 1: Combine Size & Taglia attributes with *take first non-empty item as text operation. In a second operation *Append attribute we SET a value IT as a suffix when the Vendor (brand) values match any of the following ones: PINKO, PATRIZIA PEPE, TWINSET, CIRCUS HOTEL, ELISABETTA FRANCHI, SPORTMAX, SPORTMAX CODE, ALYSI, OOF WEAR, CANADIAN, MAX MARA STUDIO, SILKE, NINEMINUTES, STELLA JEAN

  • Conditional Rule 2: Combine Size & Taglia attributes with *take first non-empty item as text operation. In a second operation *Append attribute we SET a value US as a suffix when the Vendor (brand) values match STEVE MADDEN

As a result, you get the following:

  • 10 US (STEVE MADDEN branded items, Conditional Rule 2 applied) 12 US (STEVE MADDEN branded items, Conditional Rule 2 applied), 38 IT (PINKO branded items, Conditional Rule 1 applied), 44 IT (PINKO branded items, Conditional Rule 1 applied), 42 IT (PINKO branded items, Conditional Rule 1 applied), 36 IT (PINKO branded items, Conditional Rule 1 applied), XL (ADIDAS branded items, Default Rule), S (ADIDAS branded items, Default Rule)

Add size system suffix by brand & size value

◉ In this case, we add a size system suffix (EU, IT, US, UK) to the exported size value, based on the item’s brand & item size value.

Take (Use) an attribute as input for the Rule

  • Shopify - Size - sample attribute values: 41, 38, 43, S, 45, XL

Define the following operations:

  • Default Rule: Take Shopify - Size attribute -> This Default Rule will be applied to all items not meeting the Conditional Rules set below.

  • Conditional Rule 1: Take Shopify - Size attribute. In a second operation *Append attribute we SET value EU as a suffix when the Vendor (brand) value is equal to MAX MARA AND Shopify - Size isn't equal to any One Size, XS, S, M

  • Conditional Rule 2: Take Shopify - Size attribute. In a second operation *Append attribute we SET value IT as a suffix when the Vendor (brand) value is equal to Dondop AND Shopify - Size isn't equal to any 38, 40, 42, 44

As a result, you get the following:

  • 41 EU (Max Mara branded item, Conditional Rule 1 applied) 38 (No branded item, Default Rule applied), 43 IT (Dondop branded item, Conditional Rule 2 applied), S (Max Mara branded item with forbidden value, Default Rule applied), XL EU (Max Mara branded item, Conditional Rule 1 applied)

Add size system suffix using Regex

◉ In this case, we add a size system suffix (EU, IT, US, UK) for numeric size values & leave text/string sizes values unchanged.

Take (Use) an attribute as input for the Rule

  • Taglia - sample attribute values: 41, 38, 43, S, 45, XL

Define the following operations:

  • Default Rule: Take Taglia attribute. In a second operation *Append attribute we SET value US as a suffix -> This Default Rule will be applied to all items not meeting the Conditional Rules set below.

  • Conditional Rule: Take Taglia only when Regex matches /^(?!.*\d).*$/ -> You can easily use Regex (Regular Expressions) in conditional rules to define match or don’t-match patterns. In this case, the expression will just match non numerical values, leaving string size values with no suffix added.

As a result, you get the following:

  • 41 US(Numerical value, Default Rule applied), 38 US (Numerical value, Default Rule applied), 43 US (Numerical value, Default Rule applied), S (Non-numerical value, Conditional Rule 1 applied), 45 US (Numerical value, Default Rule applied), XL (Non-numerical value, Conditional Rule 1 applied)

Get Made In values from descriptions

In this case, we extract country-of-origin information from product descriptions.

Take (Use) an attribute as input for the Rule

  • Description plain - attribute value: The Adidas sneaker combines modern design with everyday comfort. Made in Germany sneakers offered in red Color. It features a lightweight upper and a durable rubber sole that provide reliable support for daily wear. The cushioned midsole helps absorb impact while walking, while breathable materials keep your feet comfortable throughout the day. With its clean look and versatile style, this sneaker works well with both casual outfits and active lifestyles.

Define the following operations:

  • extract text after/before set a prefix Made in and suffix sneakers -> If the Made in value could be found, as well, between other prefix/suffix, in the last step of the first operation, if failed, select return original to be able to add a second operation in the same rule with a different prefix & suffix.

As a result, you get the following:

  • Germany

Set price markups by brand

◉ Here, we add multiple price mark ups based on the item brand values

Take an attribute as input for the Rule

  • Price Regular Include Tax - sample attribute values: 100.00, 175.50, 200.15, 75.50, 99.99

Define the following operations:

  • Default Rule: Take Price Regular Include Tax & Add a percentage operation to increase the value by a 10% -> This Default Rule will be applied to all items not meeting the Conditional Rules set below.

  • Conditional Rule 1: Take Price Regular Include Tax & Add a percentage operation to increase the value by a 15% Only When the Vendor Is equal to any of Calvin Klein, Trussardi, Guess or Gucci-> This Condition Rule will be applied to all items with brands fully matching (case sensitive) the values inserted.

  • Conditional Rule 2: Take Price Regular Include Tax & Add a percentage operation to increase the value by a 30% Only When the Vendor Contains any of Armani or Gabbana values -> This Condition Rule will be applied to all items with brands containing (partial matching) any of the values inserted.

As a result, you get the following:

  • 110.00 (No branded item, Default Rule applied), 201.82 (Gucci branded item, Conditional Rule 1 applied), 230.17 (Guess branded item, Conditional Rule 1 applied), 98.15 (Armani branded item, Conditional Rule 2 applied), 114.98 (Calvin Klein branded item, Conditional Rule 1 applied)

Did this answer your question?