Skip to content

How to use catalogue price rules & cart price rules in Magento (Adobe Commerce)

conditions_and_rules_in_adobe_commerce_magento

In Adobe Commerce (formerly Magento) there are several places where you can apply Rules for discounts and promotions. The rules engine that often appears in these discount generators can and does also appear in other plugins and extensions in the CMS. Wherever it appears it roughly works the same.

How the rules engine appears in Magento
How the rules engine appears in Magento

The most common applications of this rules engine appear on Catalogue Price Rules and Cart Price Rules. For users of Adobe Commerce Cloud or with extensions such as Aheadworks Automatic Related Products you will also find this rules engine powering the relations of related, upsell and cross-sell products.

Catalogue Price Rules

Catalogue pricing is a great way to offer discounts on products. This type of price rule doesn’t use coupon codes, because it’s triggered before you even put anything in your cart! For example, you can set up conditions such as customer groups and categories that when met will show special prices for certain types or colours if available. This is much more convenient than searching through all those options individually online.

Cart Price Rules

Cart or basket price rules apply discounts to items in the shopping basket, based on a set of conditions defined by the rules engine we are talking about. The discount can be applied automatically, or when the customer enters a valid coupon code. When applied, the discount appears in the basket under the subtotal. A cart price rule can be used as needed for a season or promotion by changing its status and date range. Catalogue and Cart Rules are found under Marketing in the Admin sidebar:

Catalog and Cart Rules can be found under Marketing in the Magento Admin sidebar
Catalog and Cart Rules can be found under Marketing in the Magento Admin sidebar

The conditions feature of Adobe Commerce is a useful and powerful tool, however, it can be incredibly confusing. You need to know how to use it properly to get the most out of it. Below is a brief explanation to help you get the basics right and avoid making some of the mistakes I made when first working with Magento.

Getting started with promo rules

How to apply a rule to all items?

This one is easy, don’t add any conditions, and by default, it will apply to all pages, products, categories or customers, depending on what you’re using it on.

Making a rules condition

The conditions in Adobe Commerce use logic, which can look confusing at first. The default starting line for a condition is: “If All of these conditions are TRUE.”

If a word is bold and or capitalised, it’s something you can change. So what does this mean and how do you use it?

What are ALL or ANY rules conditions in Magento?

ALL means that something must match all of the conditions you put below for the rule to apply, and cannot match just one of them.

ANY means that any of the conditions you put below can match, even if it’s just one, and the rule will apply.

What are TRUE or FALSE rules conditions in Magento?

TRUE means the condition added matches something about an object. If the condition is “the colour attribute is red”, then only things with red as their colour attribute will match this condition. This is useful for including a specific item from a large list you want the rule to apply to.

FALSE means the condition added does not match the object. If the condition is again “the colour attribute is red”, then anything that DOES NOT have the red colour attribute will match this condition. This is useful for excluding a specific item from a large list you want the rule to apply to.

Example of ALL or ANY and TRUE or False

How to use catalogue price rules & cart price rules in Magento (Adobe Commerce)

You set the rules below to be:

  • ALL of these are TRUE
    • Category is Tops
    • Colour is red

This is how the rules would apply. Remember here were are looking for ALL of these are TRUE which means everything must match.

A t-shirt in the Tops category that has the colour red.

RuleValue on ItemMatch
Colour is redRed
Category IS TopsTops
Discount applied?Yes

The Red attribute of colour and the Category assignment of Tops match so the result is a TRUE


What about a t-shirt in the Tops category with the colour blue?

RuleValue on ItemMatch
Colour is redBlue
Category IS TopsTops
Discount applied?No

The colour attribute does NOT match Red as it’s Blue. Therefore the discount does not apply


What about a Ball in the Tees category with the colour red?

RuleValue on ItemMatch
Colour is redRed
Category IS TopsTops
Discount applied?Yes

Yes, this matches. But it’s not a T-Shirt you say. This is because we have nothing in our ruleset about what type of product it is. As long as the Colour and Category match then it will pass. If we wanted to ensure ONLY T-Shirts match the discount we would need to add a way to identify them. Such as Attribute.

Like this:

RuleValue on ItemMatch
Colour is redRed
Category IS TopsTops
Attribute Set IS TopBall
Discount applied?No

We can see now that because we are saying ALL are True and we don’t get a match on the Attribute set the discount is not applied. This is how this might look in your rules engine.

How to use catalogue price rules & cart price rules in Magento (Adobe Commerce)

IS and IS ONE OF – Watch out for this one!!

One of the most common support tickets is “My discount codes aren’t working in Magento” or My discount code rules are not working in Magento

Usually, this is because of Category-based rules and the wrong use of IS and IS ONE OF.

Let’s take a quick look. We’ve set up our rule and it looks something like this.

How to use catalogue price rules & cart price rules in Magento (Adobe Commerce)
IS will match ALL of the items in a selection

We are hoping to give a discount on ANY product in the Category of Jackets, Hoodies & Sweatshirts or Tees.

The rules are setup as:

Give a discount if ALL of these conditions are TRUE. The category IS Jackets (23) AND Hoodies & Sweatshirts (24) AND Tees (25)

Let’s put a Jacket from our store into the cart and see what happens on our table and check if it matches to get the discount.

RuleValue on ItemIS?Match
Category2321 23 24
Discount applied?No

We can clearly see that 23 is not 21 23 24 because it is only assigned to the category of Jackets and IS will match ALL of the items selected.

In this instance we need to use IS ONE OF

How to use catalogue price rules & cart price rules in Magento (Adobe Commerce)
IS ONE OF will match one of the items in a selection
RuleValue on ItemIS ONE OF?Match
Category2321 23 24
Discount applied?Yes 🥳

Success. 23 is one of 21 or 23 or 24 so it matches.

This is one of the most common reasons why Magento discount rules aren’t working so check if you really do mean IS instead IS ONE OF when doing promotions involving Categories.

An attribute is missing from Conditions in Magento

The second most common support ticket is when a Condition is missing from rules in Magento. Especially “Price is missing from the Cart or Checkout Promotional Rules”

You might be surprised to learn that Magento doesn’t actually include this by default in the rules engine but it’s really easy to add this and others.

Here’s how you replicate the issue

You click the green plus and under Please choose conditions to add the item, you want to base your rule on is missing. The price might be missing, it might be another attribute that you have setup. It could look something like this:

How to use catalogue price rules & cart price rules in Magento (Adobe Commerce)
Price is missing from the Conditions in Cart or Catalog Rules. Read on for the fix

How to fix Magento cart price rule condition dropdown not displaying attributes

Go to Stores > Attributes > Product in the Magento admin sidebar
Go to Stores > Attributes > Product in the Magento admin sidebar

This is where you will find your missing attribute, or can create a new one if it doesn’t exist at all.

Search for your missing attribute
Search for your missing attribute

If you attribute you want to run the rule on exists it will be in here. If not you may need to create it altogether. In our example, we’re trying to add price to the cart rules conditions.

Choose the Storefront Properties tab on the left
Choose the Storefront Properties tab on the left
Change “Used for Promo Rules Conditions” to Yes
Change "Used for Promo Rules Conditions" to Yes

This is the setting that allows attributes to pull through into the Promo Rules Conditions dropdown on Category and Cart Promotions. If you’re using any extension that uses a similar rules engine and you cannot see the field you need this setting will probably be the one you need to change.

Go back to your promo rule and look for the field
Missing field in Promo Rules is now fixed and showing

The missing price field is now showing in the promo rules conditions dropdown.

More information about rules conditions

Standard Adobe Commerce conditions

If you hit the green plus symbol you can begin adding conditions.

If you’re not using any plugins you will be able to filter using conditions such as category, filterable attributes and attribute sets.

You can select multiple items in these conditions, such as category a or category b.

When you select something, for example, red in the colour attribute, it will show as “Colour is red”. You can click the “is”, and change it to” is not”, “contains”, “does not” “contains”, “is one of”, or “is not one of”.

Each of these has its specific uses, for example. If your condition is a category, and you select more than one, you want to use “is one of” to say that the product can be in either category.

Cart Specific Conditions

There are special conditions available for the cart rule. You can choose “cart subtotal”(including or excluding tax), “cart weight”, “shipping method”, “shipping postcode”, “shipping region”,” shipping payment method” and “number of items”.

Conditions combinations

You can add an addition “if all / any conditions are true/false” if you have a need, by selecting “conditions combination” from the drop-down. This can get very complicated. You must remember that this condition is inside of the starting condition. The easiest way to manage this is to treat it as its own condition, regardless of how different it may look. The above tables highlight examples of when this rule will apply. If using a conditions combination, for the sake of the whole statement, swap applies with “true”, and doesn’t apply with false. This is how the statement will treat the conditions combination line.

So here comes a complicated example, which we’ll call the ”a discount on big red things rule”, but follow with me.

(1) If ALL these conditions are TRUE:

  • (2) If ALL these conditions are TRUE:
    • (2a) Colour is red
    • (2b) Size is large
  • (3) Category is 51(clothing)

The second “if all condition”(2), is on the same level as the “category condition”(3). This means the first “if all statement”(1) is only looking at these two conditions for TRUE and FALSE.

For this to apply, the “category condition”(3) must be TRUE, and the conditions to pass the “if all condition”(2) must both be TRUE.

A large red shirt in the clothing category will receive this rule. It satisfies rule (2) because is red and large. It satisfies rule (3) because it’s in clothing. Rule (1) is satisfied because rules (2) and (3) are both true.

There are literally thousands of combinations you could use and lots of ways to achieve whatever you require, but it pays to think simply. Try a table like above, and think about edge cases. You don’t want to use 6 conditions when you could just use two.

If you got this far, welcome to Adobe Commerce conditions and good luck! And if you need a helping hand why not take advantage of our free 60 minute Magento help consultation.

Author
Co-Founder & Managing Director