Promotion Rules in Magento 2: Comprehensive Guide

Table of Content

promotion-rules-in-magento-2-comprehensive-guide
Posted in: Magento 2 Guides

Hello everyone!

Today I am going to explain yet another part of Magento. I am going to focus on discounts as a means of customer activation and retention. I offer this guide for those planning to take Magento 2 Certified Solution Specialist or similar exams.

Please note that I explain the topic with examples from Magento 2. Still, the content is relevant if you are under Magento 1.

Let us get started!

Introduction: Magento 2 promotions and discounts

When you want to offer a discount, you need to change the price of the product. The problem is, one does not simply modifies the cost of every single product. It is more handy to do it in a bulk.

Magento 2 promotion rules represent the bulk of the discount idea. Instead of dealing with single products, you can run an automated discount algorithm.

Examples:

  • 10% off for any hoodie (applied for all the hoodies automatically);
  • $5 off for any pair top+bottom (pairs are caught automatically);
  • Buy one jacket and get one for free;
  • Every 3 items just for $100;
  • For loyal customers, 10% for everything.

There are two levels of promotions in Magento: cart level and catalog level.

Catalog-level promotions modify the price of the product itself. The discount is applied before adding anything to the cart. Like in offline commerce, a store manager can inform shoppers about the sale by crossing out the “old” price and showing the better price right on the product page.

 

Example: $10 off for any jacket. It does not matter
how many jackets you buy, what else is in the cart, etc.

A Cart-level promotion  helps to offer a better price for particular orders, and the discount is applied on the cart page only.

 

Example: buy 4 and get 1 free. You can get one item
for free only if you have four or more products added to the cart. If you have three products, the
promotion will not be activated.

Regardless of the level, we need to define products under promotions and triggering events. In Magento, this filtering is powered by rule conditions.

Rules in Magento 2: what is a rule condition?

A rule condition is a statement which may be true or false in any particular case. They are used to filter something or specify a start event.

Examples:

  1. Subtotal equals or greater than 100;
  2.  Shipping State/Province is Vermont;
  3.  Red T-shirt is in the cart;
  4.  Payment method is Stripe;
  5.  Customer group is Loyal;
  6.  Shipping method is FedEx Express.

Note that rule conditions are used not only in promotions. They are also used in:

  1. Magento 2 Reward Points
    How is it used? Customers can get cash-back-style points to be used for future purchases. Rules help to organize the flow of earning points.
  2. Magento 2 Up-Sells
    How is it used? The conditions are used to automatically specify upsells. For example, you can show a product as related if material is same as current product material.
  3. Magento 2 Visual Merchandiser
    How is it used? The plugin helps to assign products to the category automatically. So, if color is red, the product is automatically assigned to “Red” category and shown on its storefront page.
  4. Magento 2 Abandoned Cart Email
    How is it used? The module tracks incomplete carts to send reminders. Rules are used to run personalized email campaigns.
  5. Magento 2 Follow Up Email 
    How is it used? Rules are used to generate triggered emails based on the customer’s activity.
  6. Magento 2 Extra Fee
    How is it used? Rules allows taking commission for specific purchases, for example, the ones paid via PayPal.
  7. Magento 2 Shipping Suite
    How is it used? Conditions are used to filter orders and offer special shipping price and magento 2 shipping discounts for some clients. For example, you can offer free shipping for $50+ orders.
  8. Magento 2 Customer Group Catalog
    How is it used? The extension allows hiding some products for different website visitors. Using the rules, you can show VIP products only to Silver, Gold or Platinum customer groups.

Condition combinations: how do conditions work together?

Magento allows combining these conditions to get more flexible filtering.

Let’s consider an example here.

If we use “ANY of the conditions are TRUE”, it is enough that one of the low-level conditions (3) is true. Here’s another example:

At Amasty, we love a customer if ANY of these conditions are TRUE
(i.e. one even is enough):
– This is a new customer.
– This is an existing customer.

If we use “ALL”, every single low-level branch should be true. If even one is FALSE, the entire high-level condition becomes FALSE  too.

My fiancée Yulia kindly suggested a nice example for this case:

The wedding party is perfect if ALL of these
conditions are TRUE:
  • All my friends and immediate family will attend the event;
  • I love my man so much;
  • I know he loves me too;
  • I have a well-planned seating chart;
  • If total quantity equals or less than 10 for a subselection of guests at the wedding matching
    ALL of these conditions:
    • Guest is in the category “I did not want to invite actually, but I had to because… you
      know”.

In case even one the conditions above FALSE, the wedding is not perfect anymore.

Trigger vs target: what is the difference between conditions and actions?

A rule, whatever it is (promotion rule, shipping rule, upsell product rule, etc.), usually consists of two parts – Сonditions and Actions. These sections may confuse anyone because they seem quite alike. Their naming may vary depending on the rule types but the key difference remains the same.

Conditions (i.e. triggers, environment conditions, activation events) are supposed to specify when we apply a rule. Normally, this is an event or a state.

Examples:

  • When a customer is in a certain customer group;
  • When a subtotal is equal to or greater than $X;
  • When there are at least two T-shirts in the cart.

Actions (i.e. product conditions, target scope) are to specify the behavior type and the target scope for your rule. Normally, they are products in the catalog.
The statement is the attribute filter.

Examples:

  • SKU is red-xs-t-shirt;
  • Color is Yellow;
  • Quantity in the cart is 5;
  • Category is Sale.

The rule may be applicable, but there are no items to apply it to. And vice versa – the target scope may be not empty, but the rule triggers are not activated, so the rule doesn’t apply.

Catalog-level discounts in Magento 2

As I have already mentioned, catalog-level promotions are applied before adding anything to the cart. They do not have any triggers for starting. Let us consider all of them.

Product-level pricing

Product pricing is a default functionality of Magento. It includes tier pricing and special pricing.

There are no conditions or rules: product-level pricing just allows setting a special promotion at the level of a particular product.

To learn more, please refer to Magento DevDocs.

Catalog price rules

The catalog price rule extends special pricing. It allows setting bulky sales for a catalog subselection.

Here we use conditions to define a target scope:

Activation triggers are not applicable here; the only exception is the start and the end date:

To learn more, please refer to Magento DevDocs.

Cart price rules in Magento 2

A cart price rule is a rule that calculates discounts on the cart page. While catalog-level promotions modify the price of the product itself, these promotions change cart subtotal.

Example: we want to offer 10% off for $100 orders.
If the order subtotal is $90, there should be no discount.

To apply this discount to particular orders only, we need to filter such orders. In this case, catalog price rule is not a good tool because it will offer 10% off regardless of the subtotal. This is where conditions and actions appear.

In its out-of-the-box edition, Magento offers four types of cart price rules. To learn more about cart price rules in Magento 2, please refer to Magento DevDocs.

Promotion solutions from Amasty

Native Magento rules work well. Yet, they aren’t always flexible enough to attract customers. And here Magento extension providers step in to help retailers tailor discounts to engage most picky customers.

Below I describe some promotion solutions from Amasty along with the problems they help to solve.

Magento 2 Custom Promo Conditions

Problems addressed:

  • How to get more options in the conditions tree?
  • How to use sales history as a condition?

Magento in its out-of-the-box edition provides basic conditions like “Subtotal is greater than”, “Items
in the cart are”, etc.

This product enables about 20 new types of flexible conditions relying on numerous sources, such as:

  • Purchase history (number of completed orders, lifetime sales, membership days, etc.);
  • Customer properties (date of birth, gender, where you found us, etc.);
  • Checkout form entries (payment method, delivery, etc.);
  • Custom checkout fields;
  • Custom account fields.

These conditions are added wherever a rule takes place: Extra Fee, Shipping Suite, email extensions and more.

Magento 2 Customer Segmentation

Problems addressed:

  • How to get more options in the conditions tree?
  • How to make your offers individualized?
  • How to run personalized email campaigns?

In Magento, every customer is assigned to a group. This attribute is static and supposed to be changed manually only.

Customer segment is a dynamic entity. It allows grouping customers by conditions:

  • People who viewed HP laptops;
  • People who have a birthday soon;
  • People who buy 3+ books monthly;
  • People who registered 1+ year ago;
  • Inactive users: no orders for 50+ days.

Like in Amasty’s Custom Conditions, segments can be used wherever rules take place.

From my own support experience, segments make the best supplementary email solutions:
abandoned cart reminders and
follow-up notifications.

Magento 2 Special Promotions

Problems addressed:

  • How to get more promotion types?
  • How to run advanced discounts calculations?

This module is to add more promotions types to your Magento webshop. By default, Magento has only 4 promotions types. The module offers more than 15 additional cases.

Examples:

  • Discounts for each Nth product (like each second 50% off);
  • Discounts for groups (like buy 3 products, get $10 off);
  • Discounts for product sets (like buy A, B, and C together just for $99);
  • Dependant discounts (Buy product X, get discount for product Y).

Functionality of Custom Conditions module is included into Pro version of Special Promotions.

Magento 2 Free Gift

Problems addressed:

  • How to give away a free sample?
  • How to upsell non-free products?

This module adds some additional promotion types. Key feature is adding new products to the cart.

Examples:

  • Automated giving free sample for every purchase;
  • Automated giving free supplements (like buy a mobile phone and get a free case);
  • Automated giving one item for free;
  • Automated adding non-free products to the cart.

Magento 2 Multiple Coupons

Problems addressed:

  • How many coupon codes can be applied per order?

Magento in its out-of-the-box edition allows to use 1 coupon code per order only. This extension resolves this problem.

Key features:

  • Applying a number of codes simultaneously;
  • Making particular coupon codes unique by making them applicable individually only.

Magento 2 Promo Banners and Product Labels

Problems addressed:

  • How to inform my customers about ongoing offers?

These modules help to highlight your ongoing promotions by showing banners or highlighting products.

Key functionality:

  • Adding ribbons for on-sale products;
  • Showing banners in the catalog, product pages and even cart pages;
  • Contextual banners: showing different banners regarding a product in the cart.
Example: when sunglasses are in the cart, you see “Best clothes for this summer” ad.

Real-life examples from the support team

If a rule doesn’t work as required, it is misconfigured. Here is a short guide on how to find a mistake in the rule.

1. Validate the scope (website, stores, storeviews).

Sometimes, a rule is available for particular stores and customer groups. You need to enable the rule for everyone to find out whether this is the reason for its faulty work.

You can consult Magento DevDocs to learn more about scopes and customer groups.

2. Remove all conditions.

If no problems with scope configs are detected, we proceed with verifying activation triggers. Rule conditions may not be met, so our rule fails to be activated. When you remove all the entries from the “Conditions” tab (one by one), you can check if they are the reason.

Here is a quick list of common mistakes of the kind.

3. Play with Actions.

If previous checks are correct, the possible mistake may dwell in the Actions tab. The very first thing to check is to erase target scope (section “Apply the rule only to cart items matching the following conditions”).

Also, it makes sense to switch the promotion type (for example, from fixed to percent discount) and look at how it works on the storefront. Sometimes the rule cannot be activated simply because it is not applicable.

4. Use promotions debugger

If you have Amasty’s  Special Promotions Pro installed, you can catch the rule that fails to work properly.

Debug mode enables certain IP address to see all the information available: rule ID, discount values, etc.:

You can find more info here

5. Remember about One-Cent Bug

Both Magento and Magento 2 are known to have rounding issues. The thing is, prices have four decimals in the Magento database (like $23.4476), but they are displayed with two decimals only (like $23.44). When you do anything with the two values (adding, subtracting, calculating percent, etc.), the result may be by 0.01 greater or lesser then expected.

These issues are called a One-Cent Bug.

Example:
Backend: $23.4476 + $1.6667 = $25.1143;
Frontend: $23.44 + $1.66 = $25.11 (expected $25.10).

The more operations you have, the bigger the difference.

If you face such a problem, I would advise just to ignore it as a minor issue.

If there is more than one cart price rule enabled, the rules can work simultaneously. The problem is, they may hamper one another.

For example, we set two promotions:

  1. When subtotal is greater than $5, a customer will get a fixed amount discount of
    $5;
  2. When subtotal is greater than $10, a customer will get a percent discount of 10%.

What should happen when the subtotal is $30?

There are three possible options:

  1. It will be ($30 – $5) – 10% = 25$ – 10% = $22.5;
  2. It will be ($30-10%) – $5 = $30 – $3- $5 = $22;
  3. It will be either 10% or $5 discount only, the second one is ignored.

To define how it should work, Magento introduced priorities and subsequent rule blocking.

All the rules in your Magento webshop are sorted by their priorities (1,2,3, etc.) When you go to the cart page, they will be processed according to this sorting (1, then 2, then 3, etc.)

If we review the case above, the priority defines the way to switch from the first calculation to the second.

Every rule has a blocking field. In Magento, it’s called “Stop Further Rules Processing”, and in Magento 2 – ”Discard Subsequent Rules”.

If this attribute is set to “Yes” and the rule is triggered, all the rules with lower priority will not be applied. Basically, this feature is used to restrict discount summing up.

Let us say, you have a catalog-level discount and cart price rule running together. Magento default promotion types always sum up discounts.

Example:

  • Hero Hoodie’s regular price is $54;
  • I have got a catalog price rule “20% for hoodies”;
  • Hero Hoodies is now $54 – 20% = $43.2;
  • I have got a cart price rule “10% off for everything”;
  • Final price will be $43.2 – 10% = $38.88.

As you can see, discounts are always summed up in default Magento.

If you have Amasty’s Special Promotions installed, you can calculate discount based on:

  • Price in the cart (after all the other discounts with higher priority);
  • Price after catalog-level discounts only;
  • Original price (no discounts regarded).

To learn more, please see this user guide.

If the required attribute is not shown in the rules tree, you need to open attribute’s config and make it enabled for rule conditions:

Magento: Go to your admin panel > Catalog > Attributes > Mange Attributes > [Required attribute] > Frontend Properties >.

Then set “Use for Promo Rule Conditions” to “Yes”.

Magento 2: Go to your admin panel > Stores > Attributes > Product > [Required attribute] > Storefront Properties.

Then set “Use for Promo Rule Conditions” to “Yes”.

If you specify an event or trigger, product attributes are displayed under “Product subselection” rule. The statement will be like:

  • If a red item is found;
  • If there are two or more items from category “New”.

Configurable, simple and virtual products are supported by rule conditions. If you use bundle or grouped products (like “SKU is my_grouped_product), the validation will fail to work.

Additionally to product discounts, a Magento 2 store manager can offer discounts for shipping.

To specify it, please go to your admin panel > Marketing > Cart Price Rules.

Open any rule and configure “Free Shipping” field.

To learn more about the shipping functionality, please refer to this shipping guide I wrote.

Two years ago, one of our  clients asked me to link one coupon code to two rules simultaneously. He wanted to give a 10% discount and a small gift (powered by Magento 2 Free Gift).

It is deprecated in Magento out-of-the-box edition. However, we found a workaround for this
particular case:

Rule 1: adding a gift is triggered by coupon code;
Rule 2: 10% discount is triggered by adding a gift.

Sum-up

Rule conditions may be really tricky and complicated, but they are also useful and the game is worth
it.

I hope this complete overview will make it clear for you.

In case you’ve got any questions, please drop us a line below.

Wish you good sales!

July 12, 2019
July 17, 2019
July 9, 2019
Comments
Angel
January 30, 2020
Hello Alexander, thanks for this guide. I need your help, I 've been working with Amasty a short time ago, so my trouble as below: I have many items and each one has two cart rules at the same time. Buy 2 and get 1 FREE and Buy 3 and get 2 FREE. Each rule would be applied when items quantity is 2 or is >= 3. However, If I add 3 or more items to cart. In the checkout's summary it's appearing both rules applied as discount amount. Then I have 3 free items instead 2 items. That's so wrong The correct way would be to apply correspondent rule, if I just have 2 items then just must be applied first rule,but if I have 3 or more items, the second rule should be applied. How I must to configure this rules to show the correct amount to pay and correct discount amount in checkout summary
Reply
Polina Litreyeva
January 31, 2020
Hello, Angel! Thanks for using our extension and for the comment. You see, it’s difficult to answer here in the comments. Please, contact our <a href="https://amasty.com/contacts/">support team</a>. We'll see what we can do. Thanks in advance!
Andrew Grant
August 21, 2020
Hi, I've been asked to look into if there is anyway to ensure that a particular discount code will only work for customers who have placed 1 or more orders before with us. The intention is to avoid the sharing around of discount codes that people receive through welcome email campaigns etc. Is there any way to do this?
Reply
Alina Bragina
August 31, 2020
Hi Andrew, yes, you can set rules for giving a discount code only for those customers who have already bought at your store. <a href="https://www.youtube.com/watch?v=0sS0FbGVC60" rel="nofollow">Watch this video guide</a> or <a href="https://amasty.com/docs/doku.php?id=magento_2:special-promotions">read the manual</a> on how to set up the restrictions and rules. If there's anything else we can help you with, feel free to drop a line via the online chat on our website or create a <a href="https://amasty.com/contacts/">ticket for support</a>.
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro

© 2009-2024 Amasty. All Rights Reserved.