How to Import and Export Magento 2 Catalog Price Rules

- E-Commerce, Magento 2, Our extensions

Consider Magento 2 Catalog Price Rules a sales booster that allows running price-focused campaigns based on the discounts. You can apply them to products with particular attributes and their combinations to achieve the highest possible flexibility. Another good thing about catalog price rules in Magento 2 is that it is a platform’s native marketing tool. Also, Catalog Price Rules are extremely user-friendly to set up. However, there is one notable inconvenience associated with this entity. You cannot import Catalog Price Rules to Magento 2 by default. Luckily, there is an opportunity to get the missing functionality. You need the Improved Import and Export extension to transfer Catalog Price Rules between Magento 2 and external systems. The details are carefully noted in the article below. You will find a sample table for the Catalog Price Rule import. After that, we will explore the Catalog Price Rule attributes used in Magento 2. Also, there is a detailed description of how to prepare for and configure a Catalog Price Rule import process.

'

Overview

It is impossible to import catalog price rules via the native Magento 2 tool. The fact pushes merchants to look for alternative software with advanced data transfer options. Improved Import and Export provides all the necessary resources for performing fast and safe catalog price rule import. 

Whether you update your database, connect your Magento 2 store with another platform, or migrate to Magento 2, the comprehensive architecture of the extension will help you to implement data in various ways. 

Improved Import and Export offers the enhanced data transfer tool in comparison to the native functionality. Along with the support of an extensive list of Magento 2 entities, the extension enables:

  • Both manual and automatic transfers with cron;
  • Additional data file formats, including CSV, XML, and others;
  • New import sources — Dropbox, GoogleSheets, etc.;

To explore the features, visit the extension page.

Sample Table for Catalog Price Rule Import 

As Magento 2 requires an entity table to retrieve data from during import, the first step is to compose the relevant structure. The fastest way to get one is to visit the Master Google Sheet created by the FireBear team. Here you can explore a sample file with a detailed explanation of the processed attributes. The corresponding table contains all the necessary info to serve as a base for your catalog price rule import.

If you want to compile a new import table from scratch, mind the following requirements for attribute creation:

Character set Unicode (UTF-8)
Field separator Comma, Tab
Text delimiter

Catalog Price Rule Attributes

In this chapter, you can find the info on the catalog price rule attributes that must be included in an import table.

Attribute name Reference Values Value example
rule_id ID of the catalog price rule. It is a unique identifier that you can use to update a particular catalog price rule Numeral 25
name The name of the catalog price rule Can be any value Underwear 10% off
description Description of the catalog price rule Can be any value 10% discount on men’s underwear sponsored by Improved Import and Export
website_ids IDs of the websites the catalog price rule is enabled for Website ID value 1
customer_group_ids Customer Groups that will be able to use the discount Customer group IDs can be found at Customers > Custom Groups > ID column.

Multiple values must be separated by commas.

0,1,2,3
from_date The date from which the cart price rule becomes active The date is processed in the following format:

yyyy/dd/mm

For example:

If you want a discount to be active from the 27th of December 2019, the value should look like:

2019-12-27

2019-12-27
to_date The date to which the cart price rule becomes active The date format should follow:

yyyy/dd/mm

For example:

If you want the discount to stop being displayed on the 31st of December 2019, the value should look like:

2019-12-31

2019-12-31
conditions_serialized The complex syntax that defines active conditions and condition combination that trigger the rule Values for categories, SKU, and product attributes enclosed in JavaScript. 

Can contain letters, numerals, and punctuation marks.

See the Sample Table
stop_rules_processing The attribute corresponds to the “Discard subsequent rules” setting. If the option is enabled all other catalog price rules will not be applied for the product 0 – Discard subsequent rules disabled

1 – Discard subsequent rules enabled

1
simple_action The attribute corresponds to the “Actions > Apply” setting. Defines the type of discount applied by the rule by_percent – the discount amount is a percent of the product price

by_fixed – the discount amount is a fixed sum

to_percent – the product price is reduced to a percent of the regular price

to_fixed – the product price is reduced to a fixed amount

to_fixed
discount_amount The amount of the discount applied to the products by the catalog price rule Numeral 15
sort_order The rule application priority Numeral (where 1 defines the highest priority) 4
is_active Specified whether the catalog price rule is enabled or disabled 0 – is disabled

1 – is enabled

1

 

Configuration of Catalog Price Rule Import

Once you have completed the data table for a catalog price rule import and installed Improved Import and Export, you are fully equipped for running the procedure. Follow System > Improved Import/Export > Import Jobs to create a new import job.

Step 1: Configuring general settings and cron 

Start with specifying general info about the rule in the first section at the job setting page. In case you need to enable automatic job running, here you can also schedule cron updates.

Step 2: Selecting Import Entity

Next, you choose ‘Catalog Price Rules’ from the list of supported entities in the import settings. If you transfer data from another platform or Magento 1, check the ‘Platform’ option to simplify the import process with built-in presets.

Step 3: Defining Import Behavior 

You are able to add, update, replace, or delete data during the import. Decide which import behavior suits your import goals. Specify the separators right in the section if the default values do not satisfy you.

Step 4: Activating Import Source

Improved Import and Export can retrieve data from various sources. The extension’s distinctive feature is the support of REST and SOAP API, FTP and SFTP, Dropbox and Google Sheets, URL, and direct file upload. The data table can provide in CSV, XML, Json, XLSX, ODS, ZIP, and TAR formats, which allows you to select any type you work with and stay flexible with your import.

You can map attributes to make sure no data will be overlapped. After the configuration is finished, don’t forget to save and run the job.

That’s it for the catalog price import. Export for the entity follows the same pattern. However, in addition to various sources and formats supported, you get the ability to extract data upon trigger events, perform consecutive export, etc.

To experience Improved Import and Export firsthand, explore the demo.

If you are interested in specifics of import or export of any other Magento 2 entity, look through our 

Guide List

Catalog Price Rule Import & Export FAQ

Let’s take a look at other nuances of importing and exporting catalog price rules in Magento 2 with the help of the Improved Import & Export Magento 2 extension.

How to import and export catalog price rules to Magento 2 automatically?

You can import catalog price rules to Magento 2 automatically on a regular basis if you use the Improved Import & Export extension. While the default import and export tools don’t support automation, unless you use Adobe Commerce, our extension utilizes a cron scheduler to automate these and other data transfers. As a store admin, you get the ability to import and export catalog price rules between Magento 2 and external destinations automatically after specifying a schedule of updates.

How to import catalog price rules with third-party attributes to Magento 2?

While Magento 2 doesn’t let you import data that doesn’t follow its requirements, you can still do that. If a table with catalog price rules contains third-party attributes, you no longer need to edit it manually. 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 catalog price rules, 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 catalog price rules to Magento 2 via API?

The Improved Import & Export Magento 2 module provides the ability to transfer catalog price rules 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 catalog price rules to Magento 2 via ODS files?

While Magento 2 works with CSV files only, you can still move catalog price rules in ODS files or export data using this format since the Improved Import & Export module supports a bunch of standards in addition to CSV.

How to import and export catalog price rules to Magento 2 via XLSX files?

While Magento 2 works with CSV files only, you can still move catalog price rules in XLSX files or export data using this format since the Improved Import & Export module supports a bunch of standards in addition to CSV.

How to import and export catalog price rules to Magento 2 via JSON files?

While Magento 2 works with CSV files only, you can still move catalog price rules in JSON files or export data using this format since the Improved Import & Export module supports a bunch of standards in addition to CSV.

How to import catalog price rules to Magento 2 via compressed files?

If your files with catalog price rules 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 catalog price rules to Magento 2 from Google Sheets?

If catalog price rules are stored in Google Sheets, you can use the Improved Import & Export extension to get them straight 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 catalog price rules from Magento 2 to Google Sheets with the help of our module.

How to import and export catalog price rules between Magento 2 and Dropbox?

The Improved Import & Export extension provides the ability to transfer catalog price rules 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 catalog price rules between Magento 2 and Google Drive?

In addition to Google Sheets and Dropbox, the Improved Import & Export extension lets you import and export catalog price rules between Magento 2 and Google Drive. You should use CSV, JSON, XML, ODS, or XLSX formats to move the data. Note that they can be compressed as ZIP or TAR archives.

'