Magento 2.2 – Stop Simple Product Images Overriding Main Product Gallery After Clicking Swatches

configurable-productgallerymagento2.2simple-productswatches

I've upgraded from 2.1.9 to 2.2.3. Now on a configurable product page when a swatch is selected the product page gallery images get overridden by the simple product image for each swatch.

This didn't used to happen and I can't find a way to stop this behaviour. I only want the configurable product images to show as in the past. I actually only have thumbnails associated with simple products to show at the checkout.

Best Answer

By adding the following code to the theme's view.xml the image from the simple product is now added to the product gallery rather than replacing the one associated with the configurable product.

<vars module="Magento_ConfigurableProduct">
    <var name="gallery_switch_strategy">prepend</var>
</vars>
Related Topic