Promotion Rules: Tips and troubleshooting
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.
- 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.
- 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 this kind.
- 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 the 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.
- 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
- 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, just ignore it as a minor issue.
How do several rules work together?
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:
When subtotal is greater than $5, a customer will get a fixed amount discount of
$5;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:
- It will be ($30 – $5) – 10% = 25$ – 10% = $22.5;
- It will be ($30-10%) – $5 = $30 – $3- $5 = $22;
- 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.
How do catalog-level and cart-level promotions affect each other?
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;
The catalog price rule “20% for hoodies”;
Hero Hoodies is now $54 – 20% = $43.2;
The cart price rule is “10% off for everything”;
The 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 discounts 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.
How to enable product attributes missing in the conditions?
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 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 the category “New”.
What product types are supported in the conditions?
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.
How to offer free shipping?
Additionally to product discounts, a Magento 2 store manager can offer discounts for shipping.
To specify it, please go to 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.
How to link one coupon code to multiple rules simultaneously?
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.
See more details on Special Promotions page
Login and Registration Form