Cart rules let you display targeted campaigns based on the contents of a visitor's shopping cart. By showing the right message at the right time, you can recover abandoned carts, increase average order value, and improve conversion rates.

Use this rule when you want to display the campaign based on the cart content of the visitors.

Typical use cases:

  • 🆓 Give a discount or free shipping to encourage customers to finish the checkout process.

  • 🏃 Add urgency with a countdown element once the cart is above a certain value.

  • 👔 Recommend matching products based on what was added to the cart.


Automatic cart detection

OptiMonk automatically detects cart contents on the following platforms once the code is installed:

  • Shopify

  • WordPress

  • WooCommerce

  • Magento

  • Shoprenter

No additional setup is required for these platforms.

If you use a different e-commerce platform, you need to add a small piece of JavaScript to your site so OptiMonk knows what is in the cart. See JavaScript code for Cart Rules for the implementation details.

💡 Cart conditions are evaluated live on the store. On a store that is not supported and has no custom cart code, the rule never matches — so a campaign carrying it never shows.


How to add a cart rule

  1. Open Campaigns in the left menu and click the campaign you want to edit.

  2. Open the Settings tab of the campaign.

  3. Scroll to Who should see the popup and click Add new rule.

  4. Pick Cart rules from the list — its subtitle reads Cart value, item count, products (Shopify & co.). The picker itself notes that Rules are combined with AND.

  5. Set up your conditions (see below), then click Save in the modal.

  6. Click Save changes in the bar at the bottom of the page.

On a campaign that is already published, the saved rules are pushed to the live campaign, so you don't have to publish again for a targeting change to take effect.

💡 You can also ask the assistant on the right to do this for you — for example "only show it above a 20,000 Ft cart value".


Available cart conditions

Each condition row starts with the same dropdown: Cart value, Number of products or Product in cart.

Cart value

Target visitors based on the total value of the products in the cart.

The operators are equals, greater than, less than, at least, at most and between (with between you get two number fields, a lower and an upper bound).

Example: display the campaign to visitors with a cart value greater than 20.

Number of products

Target based on how many items are in the cart. The same operators are available as for the cart value.

Example: show the campaign only to visitors with at least 2 products in their cart.

Product in cart

Use this when the campaign should appear for specific products. The row continues with:

  • cart contains or cart does NOT contain — the include / exclude side of the condition;

  • by name or by product — how the product is identified.

by name lets you type a property value and match it with equals, not equals, contains or not contains. This is the option to use on WordPress, WooCommerce, Magento and other stores. You can match a full product name — for example Pedigree Biscrok - Bone-Shaped, Multi-Mix Biscuits Dog Treats — or a fragment, for example every product whose name contains dog.

by product lets you pick products from your catalog instead of typing. Use Search products…, click a product to add it, and the picked products appear as chips you can remove. Catalog picking needs an active Shopify store on your account; if there is none, the app tells you so: Product picking needs an active Shopify store — you can remove selected products, or match by name instead.


If a rule was created in the classic OptiMonk admin with picked products (this is how the classic Shopify and ShopRenter product selectors work), the products travel as product IDs together with their stored details. They are shown here as chips with the product name, and you can remove them even when the picker itself is not available on your account.


Combining cart conditions

Click Add condition to add another row to the same rule. For example: the cart contains dog products and the cart value is at least 20.

The relationship between the conditions is AND — every condition has to be true at the same time. This cannot be changed.

The same is true one level up: the campaign's targeting rules are combined with AND as well, and you can add each rule type once. Cart rules already on the campaign are greyed out in the picker with an Added tag; open the existing card instead and add another condition inside it.


How to check what information is forwarded to OptiMonk about a product

When a visitor adds a product to the cart, a set of information is forwarded to OptiMonk automatically, and it is unique to each of your products. To see it for a specific product, use Google Chrome:

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

  2. Press F12 on your keyboard (or fn + F12 on Mac) to open the developer tools.

  3. Select the Application tab, and your own website under Session Storage.

  4. Click OptiMonkVisitorCart, then open the dropdown arrow to see the available information.

  5. You can use any of this information in a cart rule. For example, if the product_id is 4587144773676, that is the value a by-product rule matches on.

💡 Pay attention to upper and lower case letters when you type these values.

💡 This information is unique to each of your products.

💡 If any of the values are empty, you first have to set them up on your website's admin page before you can use them in a cart rule.