Magento 2 Cart Price Rules: Create, Edit & Import
Today, we explore Magento 2 cart price rules. The corresponding functionality is available in your site’s admin by default. As a store administrator, you can easily use it to run promotions that increase conversion and sales. However, it is necessary to understand the basics of Magento cart price rules.
By reading this article, you will learn the role of cart price rules in Magento 2, which work perfectly with catalog price rules. Below, we explore what Magento shopping cart price rules are and how to manage them. You will learn how to create cart price rules in Magento 2. We also focus on some management nuances associated with this promo tool.
Although Magento 2 lets you easily configure cart price rules, it is impossible to import them unless you use a third-party instrument, such as the Improved Import & Export extension. In this post, we will show you how to import cart price rules to Magento 2 with the help of our module. You will discover how a sample Magento 2 cart price rule import table looks, what cart price rule attributes are used, and what steps to take to import Magento 2 cart price rules.
![](https://firebearstudio.com/media/firebear-magento2-extensions/magento2-import-extension-firebear.jpg)
Table of contents
- 1 What Are Magento 2 Cart Price Rules?
- 2 How to Add Cart Price Rules in Magento 2
- 3 Magento 2 Cart Price Rules & Free Shipping
- 4 How to Import Magento 2 Cart Price Rules
- 5 Magento Cart Price Rules: Import & Export FAQ
- 5.1 How to import and export Magento 2 cart price rules automatically?
- 5.2 How to import cart price rules and coupon codes with third-party attributes to Magento 2?
- 5.3 How to import and export cart price rules to Magento 2 via API?
- 5.4 How to import and export Magento cart price rules via ODS files?
- 5.5 How to import and export cart price rules and coupon codes to Magento 2 via XLSX files?
- 5.6 How to import and export Magento 2 cart price rules via JSON files?
- 5.7 How to import cart price rules and coupon codes to Magento 2 via compressed files?
- 5.8 How to import Magento 2 cart price rules and coupon codes from Google Sheets?
- 5.9 How to import and export cart price rules and coupon codes between Magento 2 and Dropbox?
- 5.10 How to import and export Magento cart price rules and coupon codes from Google Drive?
- 6 Final Words
What Are Magento 2 Cart Price Rules?
In Magento 2, cart price rules represent a powerful promotional instrument that lets you apply discounts to items in the shopping cart, based on predefined conditions. There are two ways to apply the discount:
- It happens automatically when the conditions are met;
- A customer needs to enter a valid coupon code.
When a cart price rule is applied, the discount appears in the cart under the subtotal.
It is worth mentioning that you can set a date range for cart price rules in Magento 2 to activate them for a seasonal sale or promo campaign.
So, two unique characteristics set Magento cart price rules aside from catalog price rules: they take place in the shopping cart; a customer may need to use a coupon code to activate the discount. Catalog price rules, on the other hand, are triggered before a product is added to the cart and don’t use coupon codes.
Also, remember that Magento shopping cart price rules associated with coupons may have specific conditions bound to particular checkout options. For instance, a certain shipping or payment method may be required. Because such conditions are met only during the checkout process after the specific shipping/payment method is selected, such coupons are applied at checkout in the last step. So technically, Magento 2 cart price rules that incorporate such coupons should be named checkout price rules.
You can find Magento 2 cart price rules under Marketing -> Promotions -> Cart Price Rules.
How to Add Cart Price Rules in Magento 2
You can add a new cart price rule in Magento 2 on the main screen mentioned above. Just hit the “Add New Rule” button and Magento will redirect you to a new cart price rule screen.
A Magento cart price rule page is divided into five sections: Rule Information, Conditions, Actions, Labels, Manage Coupon Codes, and Related Dynamic Blocks.
The Rule Information tab of a new cart price rule lets you edit the name and description of your rule. Next, you can enable/disable the rule as well as assign it to websites and customer groups.
Next, there is a set of actions dedicated to coupons. For instance, choose Specific Coupon from the Coupon dropdown. You can now specify a coupon code or enable its auto-generation. It is also possible to set a limit on the number of uses per coupon or customer. You can specify the coupon’s priority to avoid conflicts with other rules. The RSS feed availability option can be turned on here as well.
Now, let’s proceed to the Conditions tab. Here, you specify the conditions that should be met to activate your Magento 2 cart price rule. For instance, you can apply it to specific products only or if products in the cart belong to specific categories, like shown below:
The Actions tab provides several unique options:
- Percent of product price discount. This option discounts items by subtracting a percentage from the original price. The discount applies to each qualifying item. For instance: Enter 10 in the Discount Amount for an updated price that is 10% less than the original price.
- Fixed amount discount. This option discounts items by subtracting a fixed amount from the original price of each qualifying item. For instance: Enter 10 in the Discount Amount for an updated price that is $10 less than the original price.
- Fixed amount discount for whole cart. This option discounts the entire cart by subtracting a fixed amount from the cart total. For example: Enter 10 in the Discount Amount to subtract $10 from the cart total. Note that this discount is applied to the cart subtotal. Use the Apply to Shipping Amount option to apply the discount to the subtotal and shipping.
- Buy X get Y free. This option defines a quantity X (Discount Qty Step) that a customer must purchase to receive a quantity Y (Discount Amount) of the same product/variation for free. A total quantity of X+Y of that same item must be added to the cart to apply the discount.
You can also enable/disable free shipping here. Just specify the conditions and select the corresponding option. We will return to this Magento cart price rule possibility below.
The Labels section lets you specify labels for different store views. They appear in the totals section of the order to identify the discount.
Under Manage Coupon Codes, specify the number of coupons, their code length, format, and other parameters.
There is a grid that contains all coupon codes related to the rule. It is filled in when you click the “Generate” button.
You can find Magento 2 dynamic blocks associated with the rule appear in the storefront whenever the conditions are met. The Related Dynamic Blocks section lets you use search filters to locate the blocks that you want to associate with the rule. You only need to select a checkbox in the first column to associate the block with your new cart price rule in Magento 2.
Magento 2 Cart Price Rules & Free Shipping
Let’s explore a specific case of Magento 2 cart price rules – free shipping. You can offer free shipping either with or without a coupon. It is also possible to apply free shipping based on a minimum order. Let’s see how to use Magento 2 shopping cart price rules to create complex conditions for providing free shipping.
Turn On Free Shipping
First of all, you need to enable free shipping in your store configuration. Turn it on for any carrier service that you want to use for free shipping.
Create A Magento 2 Cart Price Rule
Now, let’s create a new cart price rule in Magento 2 to offer free shipping. You need to complete the Rule Information according to your preferences. Follow the standard algorithm described above:
- Enter a rule name and a brief description for internal reference.
- Activate the rule
- Select sites and customer groups to offer free shipping.
- Set the Coupon option to one of the following:
- No Coupon. You will offer free shipping without a coupon.
- Specific Coupon. Your customers will need a coupon code to get free shipping.
- Scroll down, expand the Actions section, and set the following parameters:
- Select Percent of product price discount in Apply.
- Set Apply to Shipping Amount to Yes.
- Select For matching items only in Free Shipping
If you need to create a Magento 2 cart price rule that offers free shipping for orders with a specific amount, complete the General Information settings and other configurations as described above and scroll down to the Conditions section. Here, follow these steps:
- Click Add;
- Choose Subtotal from the Cart Attribute dropdown;
- Click is;
- Choose equals or greater than;
- Click “…” and enter a threshold value for the Subtotal, such as 50.
Complete The Configuration & Test Your Magento 2 Cart Price Rule with Free Shipping
Complete the configuration. When the rule is complete, click Save Rule and proceed to testing. That’s it!
How to Import Magento 2 Cart Price Rules
As you probably know native Magento 2 import procedure doesn’t let you import or export cart price rules. But you can easily get the missing functionality with the Improved Import and Export Magento 2 extension. The module provides the ability to import your coupon codes and all their basic settings with customer group and website conditions.
In addition to the Magento 2 cart price rule import the extension has another great deal to offer:
- Import and export process automation with the help of a cron scheduler;
- Support for both CSV and XML file types;
- Support for direct URL, Dropbox, and Google Sheets import sources;
- Import and export of categories, orders, CMS pages, and all native Magento 2 entities.
And many more. For the full list of features – visit the extension’s product page.
Get Improved Import Magento 2 Extension
Sample Import Table with Magento Cart Price Rules
To start the import process you will need a sample import table or a properly formatted CSV or XML draft which you will fill with the proper data. The best way to get the sample file is to visit the
If, for some reason, you want to create an import table from scratch – keep in mind the following requirements:
Character set | Unicode (UTF-8) |
Field separator | Comma, Tab |
Text delimiter | ” |
Magento Shopping Cart Price Rule Attributes
Like every entity, Magento 2 cart price rules have a special attribute reference. Here is the full list of cart price rule attributes currently supported by the Improved Import and Export extension:
Attribute Name | Reference | Values | Value Example |
name | Rule Name. The name of the Cart Price Rule | Can be any value | 10% off |
code | Coupon Code. The coupon customers will need to enter at the cart page to apply the discount | Can be any value. Leave empty if you use Auto Generation | test10%off |
uses_per_coupon | Uses per coupon. The number of times the coupon can be applied to the cart | Can be any numeral value | 10 |
description | Description of the cart price rule | Can be any value | A test 10% discount coupon imported with Improved Import and Export extension |
from_date | The date from which the cart price rule is active | The date should be in the following format:
yyyy/dd/mm For example: If you want a custom design applied from the 10th of July 2024, the value should look like this: 2024-10-07 |
2024-05-06 |
to_date | The date to which the cart price rule is active | The date should be in the following format:
yyyy/dd/mm For example: If you want to stop applying a custom design by the 10th of July 2024, the value should look like this: 2024-10-07 |
2024-10-06 |
uses_per_customer | Uses per Customer. How many times a single customer can apply this very coupon code | Can be any numeral value | 20 |
customer_group_ids | Customer Groups. The IDs of the customer groups that are eligible to apply this coupon code | You can find the IDs of the customer groups at Customers > Custom Groups > ID column of the group grid.
Use comma to separate multiple values |
1,2,3 |
is_active | Active. Defines if the cart price rule is enabled or disabled | 0 – Cart Price Rule is disabled
1 – Cart Price Rule is enabled |
1 |
stop_rules_processing | Discard subsequent rules. Defines if only this very coupon can be applied. If enabled other coupon codes cannot be applied to the cart | 0 – Discard subsequent rules disabled
1 – Discard subsequent rules enabled |
1 |
sort_order | Priority. Defines the order in which Cart Price Rules are applied to the cart. May be important if you offer several discounts at once. | Can be any numeral value. The lower the value – the higher the priority. | 10 |
simple_action | Actions > Apply. Defines the type of discount the coupon offers. Either a percent or fixed discount | Allowed values:
to_fixed – fixed amount discount cart_fixed – fixed amount discount for the whole cart by_percent – percent of product price discount |
to_fixed |
discount_amount | Discount Amount. The amount of the discount the customer gets by applying the Cart Price Rule | Can be any numeral value | 15 |
discount_qty | Maximum Qty Discount is Applied To. Maximum quantity if the product the discount can be applied to. Quantity exceeding the set value will not be discounted | Can be any numeral value. | 20 |
simple_free_shipping | Free Shipping. Defines if the items that are subject to the discount should be shipped for free | Allowed values:
0 – No 1 – For matching items only 2 – For shipment with matching items |
2 |
apply_to_shipping | Apply to Shipping Amount. Defines if the discount should also be applied to the shipping price of your cart price rule in Magento 2. | 0 – no, the discount shouldn’t be applied to shipping
1– yes, the discount is applied to shipping |
0 |
times_used | Defines how many times the coupon code has already been used | Can be any numeral value | 10 |
is_rss | Public In RSS Feed. Defines if the Cart Price Rule should be published in the RSS feed | 0 – no, don’t publish the Cart Price Rule
1 – yes, publish the Cart Price Rule |
0 |
coupon_type | Coupon. The type of the coupon code: | 1 – no coupon code
2 – specific coupon code |
2 |
use_auto_generation | Use Auto Generation. Defines if the coupon codes should be automatically generated for this Cart Price Rule | 0 – don’t use auto-generation
1 – use auto-generation |
1 |
website_ids | IDs of the websites the Cart Price Rule is applied to | Website ID value | 1 |
Importing Cart Price Rules to Magento 2
Below, we explain how to import cart price rules to Magento 2 with the help of the Improved Import and Export extension.
Step 1: Create The Job & Configure General Settings
Go to System > Improved Import / Export > Import Jobs and click the ‘Add New Job’ button to create an import profile for Magento cart price rules. At the New Job screen, you can see the General Settings section:
Enable the job, name it to identify it later in the grid, and decide if the job should run automatically or manually.
When done – scroll down to the next configuration section.
Step 2: Choose Cart Price Rule & Set The Job Behavior
Choose the entity you are importing. We are importing Cart Price Rules, so let’s stick to it.
Next, there is the Import Behavior section.
Specify what the extension should do with the data from the import table.
In addition to the behavior, you need to select a validation strategy and adjust the field and multiple value separators. The separators may come in handy when you use custom formatting.
Step 3: Select Cart Price Rules Import Format & Source
In this section, select the file format of the table with Magento cart price rules. The extension supports not only CSV tables but also XML, XLSX, ODS, and Google Sheets. Select where the table is located. In the screenshot above, you can see Google Sheets as an import source of cart price rules. You can also use FTP/SFTP, Dropbox, or manual uploads.
Click the ‘Validate file’ button to let the extension ensure the table with Magento 2 cart price rules is properly formatted.
Step 4: Save & Run The Job
Now the job is ready the only thing you are left to do is hit the ‘Save & Run’ button at the top right corner of the screen. Then, click the ‘Run’ button. The extension will do the rest, transferring cart price rules to Magento 2
The import procedure provides a log file where you can check how the job went. If required you can find the log file at your store FTP: var/log/firebear.
That’s it. You have just learned how to import Magento 2 cart price rules. If you require instructions on how to import other entities such as products, categories, or CMS pages, read the dedicated blog articles from our Magento 2 import/export guide list.
Magento Cart Price Rules: Import & Export FAQ
Let’s look at other nuances of importing and exporting cart price rules and coupon codes in Magento 2 with the help of the Improved Import & Export Magento 2 extension.
How to import and export Magento 2 cart price rules automatically?
Use the Improved Import & Export extension to import cart price rules and coupon codes to Magento 2 automatically regularly. While the default import and export tools don’t support automation, our extension utilizes a cron scheduler to automate these and other data transfers unless you use Adobe Commerce. As a store admin, you get the ability to import and export cart price rules and coupon codes between Magento 2 and external destinations automatically after specifying a schedule of updates.
How to import cart price rules and coupon codes with third-party attributes to Magento 2?
If a table with cart price rules and coupon codes contains third-party attributes, you no longer need to edit it manually before the import. The Improved Import & Export extension lets you create a mapping scheme where you match third-party attributes and values to ones used within Magento 2. As a result, any external data, including cart price rules and coupon codes, is easily adapted to the native Magento 2 standards. When it comes to export processes, you can also apply mapping to them, creating the output your partners require.
How to import and export cart price rules to Magento 2 via API?
The Improved Import & Export Magento 2 module provides the ability to transfer cart price rules and coupon codes along with other entities via API. You create API connections for transferring data to and from Magento 2 straight in the module’s import/export jobs. Specify the parameters necessary to sync the two systems right there.
How to import and export Magento cart price rules via ODS files?
Magento 2 works with CSV files only, but you can still move cart price rules and coupon codes in ODS files or export data using this format with the Improved Import & Export module.
How to import and export cart price rules and coupon codes to Magento 2 via XLSX files?
Magento 2 works with CSV files only, but you can still move cart price rules and coupon codes in XLSX files or export data using this format with the Improved Import & Export module.
How to import and export Magento 2 cart price rules via JSON files?
Magento 2 works with CSV files only, but you can still move cart price rules and coupon codes in JSON files or export data using this format with the Improved Import & Export module.
How to import cart price rules and coupon codes to Magento 2 via compressed files?
If your files with cart price rules and coupon codes are compressed, use the Improved Import & Export module to transfer them to Magento 2. Remember that your file archive should be saved as a ZIP or TAR file, containing CSV, XML, ODS, JSON, or XLSX.
How to import Magento 2 cart price rules and coupon codes from Google Sheets?
If cart price rules and coupon codes are stored in Google Sheets, use the Improved Import & Export extension to get them out of there and move them to your e-commerce website. It is only necessary to specify the address of the corresponding Google Sheets table. You can also export cart price rules and coupon codes from Magento 2 to Google Sheets with the help of our module.
How to import and export cart price rules and coupon codes between Magento 2 and Dropbox?
The Improved Import & Export extension provides the ability to transfer cart price rules and coupon codes between Magento 2 and other destinations using Dropbox as an intermediary platform. You can transfer CSV, JSON, XML, ODS, or XLSX files or ZIP and TAR archives.
How to import and export Magento cart price rules and coupon codes from Google Drive?
The Improved Import & Export extension also enables you to import and export cart price rules and coupon codes between Magento 2 and Google Drive via CSV, JSON, XML, ODS, or XLSX files. Note that they can be compressed as ZIP or TAR archives.
Final Words
Cart price rules introduce a powerful marketing instrument to Magento 2. You can easily create as many conditions as your business case requires to apply discounts, offer free shipping, and promote your products. And if you don’t want to create Magento 2 cart price rules manually, the Improved Import & Export extension is at your disposal. You can use the module to import cart price rules to Magento 2 from another e-commerce website. Follow this link to get our Magento 2 importer:
Get Improved Import Magento 2 Extension
![](https://firebearstudio.com/media/firebear-magento2-extensions/magento2-import-extension-firebear.jpg)