Product swatches
Customers have high expectations for choosing a color, and it is crucial that product descriptions accurately represent each available color, pattern, or texture. For example, the pants in the following example are not available in red, green, and blue. Rather, they are available only in specific shades of red, green, and blue, which are probably unique to this product.
{width="700" modal="regular"}
For configurable products, color can be indicated by a visual swatch, text swatch, or input control. Swatches can be used on the product page, in product listings, and in layered navigation. On the product page, swatches are synchronized to display the corresponding product image when the swatch is selected. When the customer selects the swatch, the corresponding value appears in the input field and the swatch is outlined as the current selection.
No
on the Attribute Edit page in the Admin.Text-based swatches
If an image isn’t available for a swatch, the attribute value appears as text. A text-based swatch is like a button with a text label, and behaves in the same way as a swatch with an image. When text-based swatches are used to show the available sizes, any size that is not available is crossed out.
{width="700" modal="regular"}
Swatches in layered navigation
Swatches can also be used in layered navigation, if the Use in Layered Navigation property of the color attribute is set to Yes
. The following example shows both text-based and color image swatches in layered navigation.
{width="700" modal="regular"}
Create swatches for products
Swatches can be defined as a component of the color
attribute or set up locally for a specific product and uploaded as product images.
In the earlier examples, the “Sylvia Capri” pants are available in specific values of red
, green
, and blue
. Because the swatches were taken from the product image, each is a true representation of the color. The color
attribute is used to manage the information for all product colors and swatches.
Step 1: Create the swatches
Use either of the following methods to create swatches for your products.
Method 1: Add a color swatch
-
To capture the true color of a product, open the image in a photo editor and use the eye dropper tool to identify the exact color and take note of the equivalent hexadecimal value.
{width="400"}
-
On the Admin sidebar, go to Stores > Attributes > Product.
-
In the grid, open the color attribute in edit mode.
-
Verify that Catalog Input Type for Store Owner is set to
Visual Swatch
. -
If you prefer to not display corresponding simple product images when the swatch is selected on the product display page, set Update Product Preview Image to
No
. -
Under Manage Swatch (Values of Your Attribute), click Add Swatch and do the following:
{width="600" modal="regular"}
-
In the Swatch column, click the new swatch and select Choose a color from the menu.
{width="500" modal="regular"}
-
In the color picker, place your cursor in the # field, delete the current value, and enter the six-character hexadecimal value of the new color.
{width="500" modal="regular"}
-
To save the swatch, click the Color Wheel ( ) icon in the lower-right corner of the color picker.
-
In the Admin column, enter a label to describe the color to the store administrator.
If applicable, you can also enter the translation of the color for each language supported. In the following example, the SKU is included for reference in the Admin label because the colors are used only for a specific product. You can include a space or underscore in the label, but not a hyphen.
-
In the Is Default column, select the swatch that is to be the default option.
-
To change the order of the color swatches, click the Order icon and drag the item to a new position in the list.
{width="400"}
-
-
When complete, click Save Attribute and refresh the cache when prompted.
-
Open each product in edit mode and update the Color attribute with the correct swatch.
To update multiple products at the same time, follow the steps below.
Method 2: Upload a swatch image
-
To capture an image for a swatch, open the product image in a photo editor and save a square area of the image that depicts the color, pattern, or texture.
If needed, you can repeat this action for each variation of the product.
The size and dimensions of the swatch is determined by the theme. Generally, saving an image as a square helps to preserve the aspect ratio of a pattern.
{width="400"}
-
On the Admin sidebar, go to Stores > Attributes > Product.
-
In the grid, open the color attribute in edit mode.
-
Verify that Catalog Input Type for Store Owner is set to
Visual Swatch
. -
If you prefer to not display corresponding simple product images when the swatch is selected on the product display page, set Update Product Preview Image to
No
. -
Under Manage Swatch (values of your attribute), click Add Swatch and do the following:
-
In the Swatch column, click the new swatch to display the menu and choose Upload a file.
-
Navigate to the swatch file that you prepared and choose the file to upload.
-
Repeat these steps for each swatch image.
-
Enter the labels for the Admin and storefront.
In this example, the SKU is included in the Admin label for reference because these colors are used only for a specific product. You can include a space or underscore in the label, but cannot include a hyphen.
{width="500" modal="regular"}
-
-
When complete, click Save Attribute and refresh the cache when prompted.
-
Open each product in edit mode and update the Color attribute with the correct swatch.
To update multiple products at the same time, follow the steps below.
Step 2: Update the products
-
On the Admin sidebar, go to Catalog > Products.
-
Use the Filter to display the list by Name or SKU and include only the applicable products.
-
In the grid, select the checkbox of each product to which the swatch applies.
-
Set Actions to
Update Attributes
.In this example, all blue configurations of the pants are selected.
{width="600" modal="regular"}
-
Scroll down to the Color attribute and select the Change checkbox.
{width="400"}
-
Choose the swatch that applies to the selected products and click Save.
-
When prompted, refresh the cache.
{width="200"}
Add swatches to a simple product
-
On the Admin sidebar, go to Catalog > Products.
-
Open a product in edit mode, check the product status (should be enabled).
-
Click Create Configurations button (under the
Configurations
tab). -
In the pop-up window, choose the Color attribute and Next.
-
Select color swatches from the attribute that you want to include in this product.
-
In the progress bar, click Next.
-
Configure the images, price, and quantity.
On this step, set the images, pricing, and quantity of each configuration. The available options are the same for each, and you can choose only one. You can apply the same setting to all SKUs, apply a unique setting to each SKU, or skip the settings for now.
-
When configuration for images, price, and quantity are complete, click Next in the upper-right corner.
The current product variations appear at the bottom of the Configuration section. If you are satisfied with the configurations, click Generate Products.