what I need is to hide all pics that doesn't bellongs to the selected color in swatch of configurable product, is there any way to achieve this? Thanks.

I've seen this similar question, but without any answer.

1 Answer 1


I get this using etc/view.xml file in my theme, with this configuration:

<vars module="Magento_ConfigurableProduct">
   <var name="gallery_switch_strategy">replace</var>

The Luma Theme default value is prepend. This link brings more information.

  • Isn't replace the default behaviour? Sep 4, 2018 at 9:51
  • Hi, actually I don't remember the Luma default ... but in our custom theme prepend was the default at that time.
    – lpFranz
    Sep 4, 2018 at 12:34
  • Oh, sorry. I believe in Blank the default is replace and Luma overrides it. Anyway, thanks for sharing. +1 Sep 4, 2018 at 13:21

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.