In this article you will learn how to use the Cart Item Filter feature when building rules in a campaign.

In the Rule Builder, you can "Filter Cart Items" to filter for specific items in your customers cart, manipulate this data with different transformation steps then use the saved filters in your conditions and/or effects.

You can save multiple Cart Item Filters within a rule, but note that filters only apply to a single rule. 

Creating A Cart Item Filter 

Follow these steps to create a Cart Item Filter:
  1. Create a New Campaign, 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. Give your filter a name and click Save (e.g., T-shirt_CartItems)


Using Cart Filters 

Depending on what data you send Talon.One, you can create a variety of Cart Item Filters based on your business requirements. Once you apply a filter or set of Filters, the saved Cart Item Filters can be used in a condition or effect. Choose from one or multiple Filter Steps in the drop down menu to determine how the cart data will be filtered. The available transformation steps include:  
  • Take the first item: pick the first item in an ordered list
  • Count number of items: to give a discount on a specific number of items.
  • 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
  • Select an attribute: extract the attribute from each cart item and make a list with these attributes
  • Sum up a formula: to calculate the total price or total quantity of items in the list
  • Sort items by attribute: used to sort items by ascending or descending order
  • Check if the filtered cart is empty: check if cart is empty

Some things to keep in mind:
  • Filter Steps must be added in a logical sequence and only available filter steps will appear 
  • For example, if you use the "sum" or "take the first item" filters first, you can not longer set a filter condition or select an attribute
  • If you edit the first step of a filter, you must add the steps below steps again
  • A filter can no longer be edited once you use it in a condition or effect (this will break the rule)

Example 1: Filter for item in the 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 click save, 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 For Cart 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 an identifiable name for the filter like "Amount_Jeans"
  6. Save the Cart Item 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 A Single Item From 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 an identifiable name for the filter like "Summer Sale Item"
  8. Save the Cart Item Filter. It will look like this: 

Now you can use this filter in your Effects. Select Apply Cart Item Discount and choose to either make this item free or apply a discount only to this single item. So if a customer has multiple sale products in their basket, you will give a discount on only one item. 

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: