In this article you will learn how to use the Cart Item Filter feature in the Rule Builder. We will cover the following sections:  You can define Cart Item Filters to create more granular rules based on items in a customer's cart. Save one or multiple filters then use them in the conditions and/or effects of your campaign rules. 

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.

Note: We released a new version of Cart Item Filters (May 2019) that allows you to create Global Cart Item Filters. This means you can create a filter and use it in multiple rules. Old filters will appear in your rules with the label "legacy" and can still be edited, but any new filter will be a "global" filter.

Available Filter Steps

When you add a new filter, you will need to add at least one or more filter steps. The available steps to help transform your list of items are as follows:
  • 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)

Creating A Cart Item Filter 

Follow these steps to create a Cart Item Filter in the rule builder.
  1. Navigate to the Rule Builder and click +Add Rule
  2. Click on Filter Cart Items, located on the top right below the Save button
  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 



Example 1: Item Discount

  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 Per 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.

Editing an active Cart Item Filter

Cart Item Filters that are currently being used in a rule can be edited, but there are some restrictions in place to prevent rule logic from breaking.
In order to save changes to an active Cart Item Filter, the Name and Output Type of the filter must remain the same.

When editing the filter, the output type is shown in the top right corner.
If this output type is changed and no longer matches the saved output type for this active filter, a message will alert you that your edits cannot be saved.
In the below example, the user has attempted to change the filter type from List of Numbers to a List of Strings, and so will not be able to save.



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: