Magento 2.2.x Notice: As outlined by the Magento Software Lifecycle Policy, Magento 2.2.x has reached the End-of-Support and will no longer receive quality fixes or documentation updates. To maintain your site's performance, security, and PCIPayment Card Industry: Refers to debit and credit cards and their associated businesses. compliance, upgrade to the latest version of Magento.
Importing Configurable Products
The best way to understand how configurable product data is structured, is to export a configurable product and its variations, and examine the data in a spreadsheet.
In the following example, you will add a set of product variations for a new size in each color. First, you will export the configurable product, and examine the data structure. Then, you will update the data and import it back into the catalog. If you don’t want to go through the exercise of exporting the data, you can download the CSVComma Separated Values: A type of file used to store data values which are separated from each other by commas. file that is used in the example.
|1.||Before you begin, make sure that the attributes that are used for product variations have the required property settings.|
The input type of any attribute that is used for a product variation must be one of the following:
|2.||If you are adding a new size or color, or making any other change to an existing attribute, make sure to update the attribute with the new value.|
|a.||On the Admin sidebar choose Stores. Then under Attributes, choose Product.|
|b.||Find the attribute in the list, and open in edit mode.|
|c.||Add the new value to the attribute. In the following example, a new size is added to a Text Swatch.|
|3.||When complete, tap Save Attribute.|
|4.||If you are adding a new attribute, follow the instructions to create the attribute before you begin.|
|1.||On the Admin sidebar, choose Catalog. Then, tap Products, and do the following:|
|a.||Tap Filters. Then, set Type to “Configurable Product, and tap Apply Filters.|
|b.||Choose the configurable product that you want to use for your test export, and take note of the SKU.|
|2.||On the Admin sidebar, choose System. Then under Data Transfer, choose Export.|
|3.||Under Export Settings, do the following:|
|a.||Set Entity Type to “Products”.|
|b.||Set Export File Format to “CSV”.|
|4.||Under Entity Attributes, scroll down to SKU. Then, do the following:|
|a.||Enter the SKU of the configurable product that you have chosen to export, and tap Continue.|
|b.||When the export file appears at the bottom of the window, click Open.|
When opened in a spreadsheet, the CSV file has a separate row for each simple product variation, and one row for the configurable product. The
product_type column shows multiple simple product variations that are associated with one configurable product.
|c.||Scroll to the far right of the worksheet to find the following columns. In this example, the data can be found in columns CG and CH.|
Defines the one-to-many relationship between the configurable product record and each variation.
Defines the label that identifies each variation.
Depending on the number of variations, the string of data in the
configurable_variations column can be quite long. The data is used an an index to the associated product variations, and has the following structure:
Each sku is separated by a pipe symbol (|), and attributes are separated by a comma. The value of each attribute is represented by the attribute code, rather than the attribute label. Here’s how the actual data appears:
|5.||When you understand the structure of configurable product data, you can edit the data, or add new variations directly to the CSV file. To learn more, see: Complex Data.|
In the following example, the set of XL sizes is copied and pasted into the worksheet to create a new set of product variations for a new size in each color.
|1.||Copy the set of product variations that you want to use as a template for the new products.|
|2.||Insert the copied rows records into the worksheet. You now have two identical sets of the simple product variations.|
|3.||Update the data in the following columns of the new variations, as needed. For this example, all the “XL” references are changed to “XXL”.|
|4.||The next step is to update the information in the
|a.||On the row with the configurable product record, click the cell that contains the
|b.||Paste the parameters to the end of the data. Then, edit as needed for the new variations. In this example, the
|5.||Before the data is imported back into the catalog, delete any rows that have not changed.|
In this example. only the three new variations for the new size, and the row with the updated configurable product are imported back into the catalog. The other rows can be deleted from the CSV file. However, make sure not to delete the header row with column labels.
|6.||Save the CSV file.The data is ready to import into the catalog.|
The size of an import file cannot be larger than 2 megabytes.
|1.||On the Admin sidebar, choose System. Then under Data Transfer, choose Import.|
|2.||Under Import Settings, set Entity Type to “Products”.|
|3.||Under Import Behavior, set Import Behavior to “Add/Update”.|
|4.||Under File to Import, tap Choose File. Then, navigate to the CSV file that you prepared for import and choose the file.|
|5.||In the upper-right corner tap Check Data.|
|6.||If the file is valid, tap Import. Otherwise, correct any problems found in the data and try again.|
|7.||When the import is complete, click the Cache Management link in the message at the top of the page. Then, refresh all invalid caches.|
The new product variations are now available in the catalog from the Admin and in the storefront. In this example, the hoodie is now available in size XXL for all colors.