Who to show - Cart rules

In this article:

If you have a Shoprenter, Shopify, WordPress, WooCommerce or Magento site, OptiMonk can automatically detect the content of the visitor’s cart and use this information for the display rules of the messages once the OptiMonk application is installed. This way you can display popups based on the conditions detailed below. 

If you have a different webstore than the above, you will need to add code to use cart rules: https://support.optimonk.com/hc/en-us/articles/204743951-Ecommerce-Cart-Segmentation

Note: if you already have rules set up with the old Cart rules, you can still edit and use the old rules. If you want to use the new Cart rules detailed in this article, you will need to delete the old Cart rule you already have set up and then add the rule again with the below steps. Click on the red "X" icon on the right to delete it:


How to add a new cart rule?

1. Log in to your OptiMonk account at https://app.optimonk.com/

2. Click on Campaigns on the left and select the Campaign you wish to edit:


3. Select Edit settings on the right:


4. Click on Select who should see the popup and then click on Add new condition:


5. Scroll down and select Cart rules:

6. You will see the available conditions on the next screen:

Conditions for a Shoprenter or Shopify store


  1. The cart value is
  2. The total number of products are
  3. The number of product types is 
  4. Any of the following products
  5. All of the following products
  6. None of the following products

Conditions for other stores


  1. The cart value is
  2. The total number of products are
  3. The number of product types is 
  4. Any of the items in the cart
  5. All of the items in the cart
  6. None of the items in the cart

Let’s see how to set the rules up!

The cart value is

Use this rule when you would like to target your visitors based on the total value of the products added to the cart. Example: Display the popup for those visitors who have a cart value between $20 and $50.


The total number of products are

This rule allows you to configure the popup to appear based on the number of items a visitor has added to their cart. Example: Display the popup for only those visitors who have at least two products in their cart.


The number of product types is

When you wish to set the popup to appear when different products are added to the cart, you need to add this rule to your campaign.  For example, the popup should appear when there are at least 3 different products in the visitor's cart:


Rules based on specific products in the cart

If you want to define that the popup should appear when specific products are added to the cart, you can do this using our advanced settings:

For Shopify and ShopRenter stores:


For other stores:


If you have a Shopify or Shoprenter store, it's a bit easier, as in these cases you just need to select the products - by clicking on the ‘+Select products’ button - from the product catalogue where you can find a list of the products you have already uploaded to your Shopify or Shoprenter store.

For example, display the popup for those visitors who do not have specific products in their shopping cart:


For Magento, WordPress, WooCommerce or other stores

For Magento, WordPress or WooCommerce and other stores, you can set rules based on Product Name, Product ID, or SKU. These IDs are listed in the source code of your website. Don’t worry, it sounds more difficult than it really is :)

In this example, I will use Product ID to demonstrate the setup process.

Simply select the rule you would like to set up on this screen:


Right after clicking on it some extra information will be needed to continue:


Let’s see how to fill in this form.

When a visitor adds a product to the cart, a bunch of information is forwarded to OptiMonk automatically. This looks something like this:


Of course, this information is unique to each of your products.

If you want to check what information is forwarded to OptiMonk for a specific product, you can do so with the following steps using the Google Chrome browser:

Step 1:  Go to your store as a visitor, and add the product to your cart.

Step 2:  Once the product is added to the cart, you will see the information forwarded by pressing F12 on your keyboard (or fn + F12 on Mac).

Step 3: Select Application in the new window, and select your own website under Session storage:


Step 4: Click on OptiMonkVisitorCart, then on the dropdown arrow to see the available information:

You can use this information to set up rules for your Campaigns:


You could use any of this information for the Cart rules. Let's use the product_id for this example:


As you can see above, the product_id is 4587144773676, so the rule would look like this:


Please also pay attention to upper and lower case letters when defining these values.

You can use any of the below information to set up rules just like this:


Of course, this information is unique to each of your products.

Note: as you can see above, the value of the SKU in the example is empty. It is because you need to set up the SKU on your website's admin page first before you can use it for the Cart rules.

Combining more cart rules

Cart rules can be combined freely to make your targeting as personalized as possible. To add more cart rules to your popup, just click on the little "+ Add another rule" button on the left, as you see in the example below. The popup should appear when the cart value is above $50 and at least one of them is X or Y product:



If you have any further questions or need any help, please contact us at support@optimonk.com, and we would be happy to assist you :)

Have more questions? Submit a request