How to import Magento 2 product images and swatches

swatch and image import

Lack of decent product content is what prevents ecommerce businesses from booming. The years of industry growth have proved crucial the support of offers with a trustable and detailed visual representation. Thus, your store can deem credible to any visitor. In addition, engaging audio and video, catchy images, and other multimedia themselves can become solid marketing tools. 

To show you how to enrich your site content, below, we are going to discover the ways to create visual/color swatches and to import them as well as product images into a Magento 2 store. The following article sheds light upon the two topics: Magento 2 color swatches and Magento 2 product images. First of all, we provide a short guide to the former. You will find out what Magento 2 product swatches are and why you should use them. Next, we explain how to create this content type associated with configurable products. Of course, you will also discover a standalone chapter dedicated to the Magento 2 color swatch import.

After that, we proceed to the detailed description of the Magento 2 image import. You will see all the primary attributes needed for composing a data table for product image import. Besides, there is a thorough description of the import job associated with both Magento 2 product swatches and Magento 2 product images. So, let’s see what instruments are at your service in the Magento 2 backend and how to make up a shortfall in powerful data transfer solutions there.

Table of contents

Guide to Magento 2 swatches

The configurable products are a great way to provide flexible offers in your store. Product variations help appeal to all types of customers and increase sales significantly. That’s why it is imperative to present masterfully all the options that define configurable products in your store. Visual swatches serve the very illustrative purpose and allow you to support configurable product variations with display images of color, pattern, material, etc. 

Visual swatches in Magento 2 are images and color icons that provide information about product variations. Similar to size, swatches are unique attributes available for configurables that enable frontend selection interactions with such products. 

Swatches assist in enhancing the user experience at your store. Swatches of configurable products are visible at the product page and anywhere in the catalog, including layered navigation. Once a customer gets a clear understanding of what they are going to buy and can select the desired option in a few clicks, successful order placement becomes the most plausible result. 

Creating a swatch

New visual swatches can be added to the database at Stores > Attributes > Product > Add New Attribute

You need to give a swatch attribute title and select ‘Visual Swatch’ from the attribute type dropdown.

swatch attribute

By default, swatches can be created in two ways:

  • Select a color out of the palette;
  • Upload a swatch as an image;

Improved Import and Export allows users to import visual/color swatches to Magento 2 via URL. This is the most efficient way as you can retrieve product images right from the manufacturer’s side or relevant web sources without the need to store the images at your own hardware.

If you possess in-depth knowledge of Magento 2 you can configure extra swatch properties for both backend and frontend management.

swatch generation

Keep in mind that Magento 2 supports text swatches as well. The text swatches generation is similar to that of visual swatches. You can transfer them following the steps of the visual swatch import we describe below.

Magento 2 swatch import

Magento 2 visual swatches can be imported following two different logic patterns: as a single color attribute or within additional attributes of a configurable product. Both types allow implementing a swatch via a particular HTML color code or an image URL. 

Swatch import within the color attribute can be run upon defining the base attributes: sku, attribute_set_code, color in the import data table. See the table below for details.

Visit the Sample Google Sheet

Attribute name Reference Values Value example
sku A unique value that is used to identify the product. The only mandatory field. SKU is the first field of the table and canNOT be removed.

Supports letters, numbers, signs “-“, “_”. Can be up to 64 characters in length. Can not contain white spaces. 

Mind the letter case!

You can find SKUs for products already in the catalog at Catalog > Products.

downloadable-1
attribute_set_code Defines Attribute Set assigned to the product. It should look exactly the same as an attribute set name including capital letters (e.g. “Default”, “Man shoes” etc.)

Attribute set name can be found under Stores > Attribute Set

attibute_set_code – is the default value for this column.

This is also a mapping column containing ALL available product attributes, in case you need a quick reference to map data.

default
color An attribute that specifies product color. Any color name, color code, or URL. Can include special signs. Values should be divided by a vertical bar “|”.

Visual swatch as a color attribute value contains extra syntax:

type=1 — defines color code import

type=2 — defines import via image URL

Blue Navy|type=2|value=

https://firebearstudio.com/blog/wp-

content/uploads/2014/10/

Firebear_logo_294x84_quer.png

Gray|type=1|value=#ffffff

The data table for transferring swatches requires adding the additional_attributes column to the product import table. In this case, the swatch values will have the same syntax as the color attribute during the single swatch attribute import. The base attributes for such import are sku, attribute_set_code, additional_attributes; they must be specified for a successful swatch data implementation.

See the Sample Google Sheet

Magento 2 swatch image is extremely useful when you need to save time on creating and applying swatches to products manually. During import you can both generate new swatches or assign the existing ones to SKUs of configurable data variations in data files. There’s no need to add a parent configurable to an import table, as the functionality matches swatches to specified SKUs.

Magento 2 product image import

Product images in Magento 2 are essential for presenting your products on the store pages and highlighting them in the catalog and search results, during the promotions, etc. 

As an attribute the product image, whether it is base, thumbnail, or any other kind, is tightly connected to product SKU and Attribute Set. These are primary attributes that are needed for composing a data table for product image import.

Attribute name Reference Values Value example
sku A unique value that is used to identify the product. The only mandatory field. SKU is the first field of the table and canNOT be removed.

Supports letters, numbers, signs “-“, “_”.Can be up to 64 characters in length. Can not contain white spaces. 

Mind the letter case!

You can find SKUs for products already in the catalog at Catalog > Products.

downloadable-1
attribute_set_code Defines Attribute Set assigned to the product. It should look exactly the same as an attribute set name including capital letters (e.g. “Default”, “Man shoes” etc.)

Attribute set name can be found under Stores > Attribute Set

attibute_set_code – is the default value for this column.

This is also a mapping column containing ALL available product attributes, in case you need a quick reference to map data.

default
Base_image, 

additional_images, 

small_image, 

thumbnail_image, 

swatch_image (in case product image is used as a swatch)

The file names of any additional image or URLs, to be associated with the product. Should be separated with commas.

Image files should be uploaded to  /pub/media/import.

The path of /sample_data/m/b/mb01-blue-0.jpg has the following structure: /pub/media/import/sample_data/m/b/mb01-blue-0.jpg

In addition, you can use a direct URL of an image, such as http://site.com/images/some_image.jpg

http://site.com/images/

some_image.jpg

Don’t forget that you can support import images with the following attributes: base_image_label, additional_image_labels, small_image_label, thumbnail_image_label, swatch_image_label to add the alt text to them.

Explore the Master Google Sheets Table

Images are irreplaceable means for product visualization, however, large catalog management can take much longer than one can expect. That’s why Improved Import and Export for Magento 2 has been embued with the ability to apply values to multiple attributes at a time. Maximum automation of product image import helps you to save time and efforts during migrations, synchronizations, and any kinds of database updates.

Import job configuration

As you’ve seen above, the most efficient swatch and image import can be performed only with the help of Magento 2 Improved Import and Export. The extension introduces advanced functionality that enables fast and error-free data transfers following unique logic for each Magento 2 entity. 

Improved Import and Export uses jobs — rules for data extraction and implementation — for transfer configuration. You can find the job grid at System > Improved Import/Export > Import/Export jobs.

With the extension, you can experience both manual and automatic import and export. Set up cron to schedule an import job once and get the updates done by the functionality alone.

Both swatch and product image import are run on the base of the ‘Products’ entity. So you need to select the relevant entity type to let the extension decide on the process logic.

product entity

If you want to create swatches on the spot, specify the ‘Add/Update’ as the import behavior. In case you want to replace existing swatches or product images, choose the ‘ Replace’ option.

Import source selector is another extension feature that allows you to stay flexible during any transfer. You can import data from REST & SOAP API, Google Drive, Google Sheets, FTP/SFTP, URL, Dropbox, or direct file upload

Speaking about the file formats supported, we can’t help but note that Improved Import and Export is the only solution that gives you the ability to manage data the way you are most comfortable with. The swatch and product image import are available for data tables in:

  • CSV, 
  • XML, 
  • XLSX, 
  • ODS, 
  • JSON, 
  • ZIP and TAR.

Once the core features are set up and the data file validated, you can map attributes massively. The mapping functionality supports any kin do modification to attribute values, allows you to translate content, round prices, and even create configurable products on the fly (with the Magento 2 Improved Configurable Products integration).

All in all, you can significantly simplify the database update routine with Improved Import and Export while still reaching out to customers with strong visual content and interactive offers. Try out the extension and see how much you can benefit from a single data management solution.

 Get Improved Import and Export

Magento 2 Color Swatches FAQ

Below, we provide answers to questions that Magento 2 users often ask when it comes to the color swatch import.

How to import color swatches to Magento 2 automatically?

If you need to transfer color swatches to Magento 2 on a regular basis, it is necessary to install a third-party tool. Unfortunately, the default import/export solutions don’t let you create import jobs that run on schedule. Therefore, we recommend you to use the Improved Import & Export extension to import color swatches to Magento 2 automatically. The extension leverages cron so that you can create a schedule of updates. Next, the module does everything for you.

How to import color swatches to Magento 2 from external systems?

While the default Magento 2 import mechanisms block the import of third-party data that doesn’t follow the system’s requirements, you can use the Improved Import & Export extension to circumvent these restrictions. The module lets you create a mapping scheme matching any external values to the default Magento 2 attributes. Consequently, any external data is easily adapted to the native standards of your e-commerce website. The most intriguing aspect is that you do everything right in your admin.

How to import color swatches to Magento 2 via API?

You need to use the Improved Import & Export Magento 2 extension to import color watches to Magento 2 via API. Our extension lets you create the connection between the two systems transferring any data, including color swatches and product images. Any import job provides an interface where you can specify the parameters necessary to put the two systems together.

How to import color swatches to Magento 2 via ODS files?

If the color swatch data is stored in an ODS file, you no longer need to convert it to a CSV file to fit the Magento 2 requirements. With the Improved Import & Export Magento 2 extension, it is possible to import ODS files to your ecommerce website without any necessity to run the conversion.

How to import color swatches to Magento 2 via XLSX files?

If the color swatch data is stored in an XLSX file, you no longer need to convert it to a CSV file to fit the Magento 2 requirements. With the Improved Import & Export Magento 2 extension, it is possible to import XLSX files to your ecommerce website without any necessity to run the conversion.

How to import color swatches to Magento 2 via JSON files?

If the color swatch data is stored in an ODS file, you no longer need to convert it to a CSV file to fit the Magento 2 requirements. With the Improved Import & Export Magento 2 extension, it is possible to import JSON files to your ecommerce website without any necessity to run the conversion.

How to import color swatches to Magento 2 via compressed files?

If the color swatch data is stored in a compressed file, you can also transfer it to Magento 2 with the help of the Improved Import & Export extension. However, there are two requirements to follow. Firstly, your file archive should be in a ZIP or TAR format. Secondly, the compressed data should be stored in a CSV, XML, ODS, XLSX, or JSON file.

How to import color swatches to Magento 2 from Google Sheets?

If your color swatch data is stored in Google Sheets, it is no longer a problem. There is no need to export it from the service and then transfer the output to Magento 2. The Improved Import & Export lets you move the corresponding information straight from Google Sheets to your e-commerce website. It is only necessary to specify the address of the corresponding data table.

How to import color swatches to Magento 2 from Dropbox?

In addition to Google Sheets, the Improved Import & Export module lets you transfer color swatches to Magento 2 from Dropbox. Your data should be stored in CSV, XML, ODS, XLSX, or JSON. If it is a compressed file, it should be in a ZIP or TAR format.

How to import color swatches to Magento 2 from Google Drive?

In addition to Google Sheets and Dropbox, the Improved Import & Export module lets you transfer color swatches to Magento 2 from Google Drive. Your data should be stored in CSV, XML, ODS, XLSX, or JSON. If it is a compressed file, it should be in a ZIP or TAR format.

Note that all these features are common for both color swatches and product images. It means that the Improved Import & Export Magento 2 extension lets you transfer product images on schedule from any external systems via different file formats and from numerous sources.

Discover more from WHO WILL CARE eCommerce

Subscribe now to keep reading and get access to the full archive.

Continue reading