In this article you will learn how to use the Cart Item Filter feature in the Rule Builder.

When building rules for a campaign, you can "Filter Cart Items" to create more granular rules based on products in a customer's cart. Save one or multiple filters in a given rule then use them in your conditions and effects. You can apply different types of filters to these "lists" of items such as the quantity, sum, most expensive item, etc. 

Multiple Cart Item Filters can be saved within a rule but these filters only apply to a single rule. 

Creating A Cart Item Filter 

Follow these steps to create a Cart Item Filter:
  1. Navigate to the Rule Builder and click +Add Rule
  2. Click on Filter Cart Items, located on the right corner of the Conditions panel
  3. Click +Add Filter Step and select a filter for your cart items
  4. Choose one or more Filter Steps depending on your requirements
  5. Name your filter something obvious (the name will appear later as an available attribute in your conditions or effects)
  6. Click Save 

 

Using Cart Filters 

Depending on what data you send Talon.One, you can create Cart Item Filters to use in your Conditions and Effects to build rules. Choose from one or multiple Filter Steps in the drop down menu to define how the information of a customer's cart can be used.

The available transformation steps include:  
  • Set a filter condition: select specific items in "Product Category", "Item Category", "Item SKU" or any custom attribute you have defined (e.g., item colour) using operators and variables
  • Sort items by attribute: used to sort items by ascending or descending order
  • Sum up a formula: to calculate the total price or total quantity of items in the list
  • Select an attribute: extract the attribute from each cart item and make a list with these attributes
  • Count number of items: to give a discount on a specific number of items.
  • Check if the filtered cart is empty: check if cart is empty
  • Take the first N items: pick the first item in an ordered list 
  • Select Nth item: choose a single item from a list in a certain position

Some things to keep in mind:
  • Filter Steps must be added in a logical sequence, only available filter steps will appear 
  • Editing the first step of a filter will make the following filter steps disappear (they must be added again)
  • Filters are "locked" once they are used in condition or effect (this will break the rule)


Example 1: Filter For Item In Cart

  1. Click +Add Filter Step and select Set a filter condition
  2. ​The default attribute is "Item Category", but you can choose from any item attribute available in the palette like Name, SKU, Weight, Category, Quantity, etc. or from a custom attribute you have added like "Sale Item" or "Item.Colour"
  3. Choose an operator (is equal to, contains, matchesRegEX, ends with, does not contain, etc.)
  4. Enter in your required value like the SKU number 123456, or category name "sweater"
  5. Type in a name and save the filter. It will look like this: 


Now you can use this cart filter in your campaign effects by selecting Apply Cart Item Discount (just one example).

The effects will look like this: 



Click the blue + button to add variables or attributes to your discount formula. For example, add the variable "Shipping Cost" if you want to give free shipping for a specific item. You have the flexibility to add any available variable or attribute to achieve your campaign requirements.  
 

Example 2: Filter Item Quantity

  1. Click +Add Filter Step and select Set a filter condition
  2. ​Select your attribute, operators and values (e.g., Item category equals "Jeans")
  3. Click +Add Filter Step and select Sum up a formula
  4. In the field choose the variable "Item Quantity" (delete the default Item Price)
  5. Type in a name and save the filter. It will look like this: 



You can also calculate the number of items in a cart. Note: This will only count the number of items, it will not calculate the quantity of items (see example above to calculate the quantity). The filter will look like this: 



Now you can use this filter in a Condition like this: 

Example 3: Filter For Single Item In List

  1. Click +Add Filter Step and select Set a filter condition
  2. ​Select your attribute, operators and values (e.g., "Sale Items" contains "Summer")
  3. Use Custom Attributes you have in the Attributes section of your account if required
  4. Add multiple filter conditions with your data points to customize your filters
  5. Click +Add Filter Step and select Take first n items
  6. In the field choose the variable "Item Quantity" (delete the default Item Price)
  7. Type in a name and save the filter. It will look like this: 



Now you can use this filter in your Effects and choose to give a discount on this item, make it free or whatever suits your requirements.

To make this item free, you can choose Set a per item discount then select the cart filter from the drop down and update the formula to "Item Quantity * Item.Price".  
 

Example 4: Cart Filter With Attribute Suggestions

  1. Click +Add Filter Step and select Set a filter condition
  2. ​Select an attribute with predefined input suggestions 
  3. Select the operator "is equal to" or "is not equal to"
  4. Select your preferred input from the drop down list
  5. You can type free text or select "Add Variable" if you suggestion does not appear 
  6. Add multiple attributes and filter steps as required.
  7. Give the filter a name and click save. It will look like this: 


If you are not familiar with using Attribute suggestions, read more here.

Conclusion

Cart Item Filters are very useful for creating more granular and targeted campaigns. There are a variety of options for filtering the information that depend on your campaign goals and the data you send Talon.One. 

To determine the best setup for your campaign, please get in touch and we will happily provide the best recommendation for your use case. 

Next you will want to read: