۶Ƶ

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.

Swatches on a product page {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.

NOTE
Swatch attributes can be configured to not display corresponding simple product images when the swatch is selected by setting the Update Product Preview Image option value to 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.

Text-Based swatch selection shows out-of-stock size {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.

Swatches in displayed 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

  1. 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.

    Hexadecimal color values {width="400"}

  2. On the Admin sidebar, go to Stores > Attributes > Product.

  3. In the grid, open the color attribute in edit mode.

  4. Verify that Catalog Input Type for Store Owner is set to Visual Swatch.

  5. 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.

  6. Under Manage Swatch (Values of Your Attribute), click Add Swatch and do the following:

    Manage Swatch Values {width="600" modal="regular"}

    • In the Swatch column, click the new swatch and select Choose a color from the menu.

      Choose a swatch color {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.

      Enter the hexidecimal value {width="500" modal="regular"}

    • To save the swatch, click the Color Wheel ( Color icon ) 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 Sort order icon icon and drag the item to a new position in the list.

      Swatch labels {width="400"}

  7. When complete, click Save Attribute and refresh the cache when prompted.

  8. 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

  1. 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.

    Swatch images {width="400"}

  2. On the Admin sidebar, go to Stores > Attributes > Product.

  3. In the grid, open the color attribute in edit mode.

  4. Verify that Catalog Input Type for Store Owner is set to Visual Swatch.

  5. 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.

  6. 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.

      Enter labels {width="500" modal="regular"}

  7. When complete, click Save Attribute and refresh the cache when prompted.

  8. 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

  1. On the Admin sidebar, go to Catalog > Products.

  2. Use the Filter to display the list by Name or SKU and include only the applicable products.

  3. In the grid, select the checkbox of each product to which the swatch applies.

  4. Set Actions to Update Attributes.

    In this example, all blue configurations of the pants are selected.

    Update product swatch attributes {width="600" modal="regular"}

  5. Scroll down to the Color attribute and select the Change checkbox.

    Change checkbox {width="400"}

  6. Choose the swatch that applies to the selected products and click Save.

  7. When prompted, refresh the cache.

    Swatch in displayed in the storefront {width="200"}

Add swatches to a simple product

  1. On the Admin sidebar, go to Catalog > Products.

  2. Open a product in edit mode, check the product status (should be enabled).

  3. Click Create Configurations button (under the Configurations tab).

  4. In the pop-up window, choose the Color attribute and Next.

  5. Select color swatches from the attribute that you want to include in this product.

  6. In the progress bar, click Next.

  7. 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.

  8. 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.

recommendation-more-help
af062d56-f22c-4537-813d-bedf8b92a071