I am new to magento2, I'm testing fresh copy of Magento 2.1.7.

I want to display Product image in place of color swatches on product detail page for Color Attribute. In the admin section, i choose (Use Product Image for Swatch if Possible) to YES.

But Product detail page still showing color swatches rather than Product image. If I run reindex and clean command in CLI Product image appear on the first load and disappear if I refresh the page again.

Website URL:



  • (Use Product Image for Swatch if Possible) where this option is available @gilbertsohal I am trying same to achive
    – siddhesh
    Commented Jul 25, 2017 at 14:10
  • 1
    Hi siddhesh please follow below Store > Attribute > Product > Color (Attribute) > Attribute Properties > Use Product Image for Swatch if Possible Hope this will help. I find in my research if i disable EAV types and attributes in Cache Management Product image appear for swatches. I think this is bug in magento!
    – user51556
    Commented Jul 26, 2017 at 22:55

2 Answers 2


Create attribute of color and add them at that time they ask for color swatch also

and at the time of add product select that attribute and color

  • No luck! I try your way @Jaimin
    – user51556
    Commented Jul 9, 2017 at 22:55

This is a bug in Magento Swatches module: Magento\Swatches\Helper\Data::getSwatchAttributesAsArray() does not populate additional_data field into attribute's fields, but its callee relies on it.

Those fields are populated by another blocks if and only if they are not cached. That's why dropping of cache helps to render swatches properly.

What you need to do is call to patch it:

    foreach ($swatchAttributes as $swatchAttribute) {
        // The next line should be added!

You can use vaimo/composer-patches to make and install patch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.