Magento – How add div after image block in Magento 2

layoutmagento2product-imagesxml

I want to add custom div after image block of product view page. In that div I will add custom html like add any text, image etc.

enter image description here

Anyone have idea how we add custom div by plugin or observer?

Best Answer

copy the gallery.phtml file from vendor/magento/module-catalog/view/frontend/templates/product/view path to paste app/design/frontend/theme/themename/Magento_Catalog/templates/product/view path and modifie below code.

<div class="gallery-placeholder _block-content-loading" data-gallery-role="gallery-placeholder">
    <div data-role="loader" class="loading-mask">
        <div class="loader">
            <img src="<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
                 alt="<?php /* @escapeNotVerified */ echo __('Loading...') ?>">
        </div>
    </div>
</div>
<div>
    Magento 2
</div>
.......
//core code

it will appear your code see pic.

enter image description here

Related Topic