How To Create Shopping Cart Price Rule in Magento 2

How To Create Shopping Cart Price Rule in Magento 2

by Van Nguyen

In Magento, cart price rule is one of the two most useful way to help store owners to launch promotion programs for customers by setting up some rules in the backend. Beside catalog price rule, shopping cart price rule plays a very crucial role in boosting up sales through attractive Marketing campaigns right on Magento sites.


As you know, Cart price rule is used for applying discounts in the shopping cart based on sets of conditions. Discounts can be automatically applied to reduce subtotal for customers when they meet conditions or when they enter a valid coupon code.


In this blog post, we will introduce you how to create a simple shopping cart price rule in Magento 2 steps by steps. For Magento 1 version, we also have a tutorial about this topic.

Step 1: Add a New Rule

You go to the Magento 2 backend and choose Marketing on the left sidebar. Then, you choose Cart Price Rules under Promotions.

magento 2 cart price rule

Click “Add New Rule” button to begin to create a Cart price rule.


4 sections are needing to be completed when setting up a new Cart price rule: Rule Information,  Conditions, Actions, and Label.


In Rule Information, you need to finish the following information:

magento 2 cart price rule

In Rule name: choose a name for your cart price rule to easily recognize and distinguish from other rules.


In Description: write a detailed description of your rule or your promotion.


In Active: set a status for your cart price rule – Active or Inactive status depends on your demands or promotions. For example, if you want your rule takes effect immediately, let’s enable the rule by setting Active status.


 In Website: choose the website to apply the rule.


(Please remember that Cart price rules in Magento 2 default only applies to the whole website. If you want to apply for store view, you need an extension to support this: Shopping cart price rule per store view, for instance).


In Customer Groups: select customer groups to apply this rule.


In Coupon: There are two options for you to choose from:


+ Option 1: No Coupon – Discount is automatically applied in the shopping cart when conditions are met.


+ Option 2: Specific Coupon – You set your wanted coupon code so that customers enter it in the shopping cart.


For Options 2, you have to complete more information:

magento 2 cart price rule

 You fill in a coupon code in Coupon Code box or you can tick Use Auto Generation for multiple coupon codes after saving the rules.


Uses per coupon: determine how many time a coupon code is used. Leave them blank if there is no limit.


Uses per people: determine how many times a coupon code is used by the same customer. This customer is a registered one and belongs to one of the selected customer group. Please note that this setting is only used for logged in customers on the website.


You set a valid time range for the rule via a calendar view in From and To box.


In Priority: Enter a number to determine the priority of the rule about the Action settings of other price rules that might be active at the same time. The lowest number will have the highest priority.


In Public in RSS Feed: Set Yes if you want to include your promotion in your store’s public RSS feed.

Step 2: Set Conditions

In this section, you will add the conditions needed to be met to get discounts in the shopping cart.

magento 2 cart price rule

You can see a statement  ” If ALL of these conditions are TRUE“:


+ Click ALL to select ALL or ANY.


+ Click TRUE to select TRUE or FALSE.


These selection helps to create different conditions.


Next, click Add icon to set up conditions: There is a drop-down list including combination types: Product attribute combination, product subselection, Condition combination, and Cart Attribute. Choose the most suitable one and continue to set up.


DID YOU KNOW: You can assign products to categories automatically based on advanced conditions with Magento 2 Dynamic Category!


You can keep on clicking Add icon to define other conditions. To delete any condition, just click Delete icon.

Step 3: Define Actions

After setting up necessary conditions for a rule, you need to define actions for the system to apply.

magento 2 cart price rule

In Apply: Select the most suitable discount.


+ Percent of product price discount: The amount after discount is the original product price minus a percentage of the original product price. The discount applies to each qualifying item in the cart. For example, the original product price is $200, after it is discounted for 20%, the price after discount is equal to $200-($200x 20%) = $160. 


+ Fixed amount discount: The amount after discount is equal to the original product price minus a fixed amount. The discount applies to each qualifying item in the cart. For example, with a fixed amount discount is $30, the amount after the discount is equal to $200 – $30 = $170. 


+ Fixed amount discount for whole cart: The amount after discount is equal the original subtotal minus a fixed amount. The discount applies to the subtotal of the whole cart.


+ Buy X get Y free: When buying a product X, customers will get product A for FREE.


In Discount Amount: Enter a number for the amount of discount.


In Maximum Qty Discount is Applied to set up a maximum quantity of the same product that can qualify for the discount in the same purchase.


In Discount Quantity Step ( Buy X): set up a mandatory quantity of product X that customers need to purchase to get product X for FREE (Used in Buy X get Y discount).


In Apply to Shipping amount:


+ Choose Yes to apply the discount amount for both subtotal and shipping cost.


+ Choose No to apply the discount amount for the only subtotal.


In Discard subsequent rules: Set Yes to stop processing other rules after this rule is applied.


In Free Shipping: Determines if free shipping is included in the promotion, and if so, for which items

Step 4: Complete The Labels

magento 2 cart price rule

 In Default Rule Label for All Store Views: You fill in your wanted label to identify discounts in all store views.


In-Store View Specific Labels: You enter each specific label for each website or each store view of a website.

Step 5: Save and Test The Rule

For Cart Price Rule in Magento 2, you will set rules to be applied for the whole website. Therefore, it is very inconvenient for Magento stores which want to offer particular promotions for each specific store views with different local customers. They can desire to give customers in English store view a 20% discount but only provide customers using French a %10 discount on some product class.


Hence, to make this issue real, an extension called Shopping Cart Price Rule per Store View for Magento 2 is developed and help store owners to quickly set up different cart price rules of products per store views.


Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.