---
title: "Commerce segmentation predicates"
slug: "commerce-segmentation-predicates"
abstract: "Overview of the Commerce segmentation predicate and the IContactCommerceInteractionProvider methods."
---
# Commerce segmentation predicates

The Commerce segmentation [predicate](https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-platform/predicates.html) targets customers who purchased a specific product where you define the product ID. To do this, a list of orders is retrieved from the [CommerceInteractionCache](https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-commerce/commerce-interactions-cache.html "Commerce Interactions Cache") using the `IContactCommerceInteractionProvider` interface. The results are filtered using the defined [segmentation rule](https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-platform/segmentation-engine.html).

The `IContactCommerceInteractionProvider` interface contains the following methods:

- Description: Methods
- Retrieves the last order ID from the Commerce Interaction cache.:

```text
string GetContactLastOrderId();

```

- Retrieves the list of orders from the Commerce Interaction cache.:

```text
IEnumerable<Order> GetContactOrders(Contact contact);

```

- Retrieves the list of carts from the Commerce Interaction cache.:

```text
IEnumerable<Cart> GetAbandonedCarts(Contact contact);

```

- Retrieves the list of visited categories from the Commerce Interaction cache.:

```text
IEnumerable<VisitedCategory> GetVisitedCategories(Contact contact);

```

- Retrieves the list of visited products from the Commerce Interaction cache.:

```text
IEnumerable<VisitedProduct> GetVisitedProducts(Contact contact);

```

The Commerce segmentation predicate `Where Contact Purchase Product with ID` is located at *sitecore/System/Rules/Definitions/Elements/Commerce - Contact*.

![The segmentation predicate Where Contact Purchase Product with ID](https://doc.sitecore.com/api/markdown-image/xp/en/developers/103/sitecore-experience-commerce/images/CommercePredicate.png)

For example, when you use the segmentation predicate "where the contact purchased product with ID" in a rule to define a segment in the List Manager, you are able to see the contacts who fulfill the rule.

![The contacts who fulfill the rule](https://doc.sitecore.com/api/markdown-image/xp/en/developers/103/sitecore-experience-commerce/images/InstaClixCameraGreenLM.png)