Enquiry Now

You can assign media objects to the various entities in Shopware’s Storefront. For example, on the product detail page, this is frequently used to display more information with images. This guide should help you get started with using media and thumbnails in your Storefront plugin.

1. add the code to this location

custom/plugins/PluginName/src/Resources/views/storefront/element/CustomElementName.html.twig

{%  set sliderConfig = element.fieldConfig.elements %}

<div class="cms-custom-image">
        {% set media = searchMedia([sliderConfig.media.value], context.context) %}
            {# @var item \Shopware\Core\Content\Media\MediaEntity #}
                  {% for item in media %}
                          <img src="{{ item.url }}">
                   {% endfor %}   
 </div>

show custom media on storefront template

Get in Touch

Vivek Khatri
Author

Founder and tech lead at Emizentech, Mr. Vivek has years of experience in developing IT infrastructure and solutions. With profound knowledge of eCommerce technologies like Shopify, Shopware, and Magento, and a capable team delivering full-fledged eCommerce development services, Mr. Vivek has helped SMEs and enterprises worldwide. His deep knowledge of the eCommerce domain enables him to identify technology innovations and trends, which are also the focus of his blogs. To learn more about how Team Vivek can assist you with your eCommerce strategy, connect with us here.

whatsapp