Beginner on Magento 2, i'm creating a Product view Page, and i'm having Problems to DISPLAY the Product Images, i just want to Display the images of the SELECTED COLOR, but it ONLY SHOWS the Configurable Product Images.

[image 11

When i click in the color options, nothing happens.




 * Product media data template
 * @var $block \Magento\Catalog\Block\Product\View\Gallery


    $images = $block->getGalleryImages()->getItems();
    foreach($images as $key => $image){

        $mainImage = current(array_filter($images, function ($img) use ($block) {
            return $block->isMainImage($img);

        $helper = $block->getData('imageHelper');
        $mainImageData = $mainImage ?


        <div class="gallery-placeholder _block-content-loading" data-gallery-role="gallery-placeholder">
                alt="main product photo"
                src="<?= /* @noEscape */ $image->getUrl() ?>"
    <?php  } ?>
  • Hi you have to check any extension installed which override core swatch-render.js file or debug core swatch-render.js file – Niraj Patel Oct 26 at 18:17
  • Actually, it works when i use the Magento_Catalog/templates/product/view/gallery.phtml in default mode, but it only show in slider(one image per time), i want to show all the images per selected color. – Rafael Fagundes Oct 26 at 18:47
  • By default magento 2 does not provide whay you want but for that you have to dig into your theme else find any free extension for gallery images – Niraj Patel Oct 26 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.