1

I have added below code inside the following path:

/app/design/frontend/magento/theme/Magento_Catalog/layout/catalog_product_view.xml

//code inside related product block

<block class="Magento\Catalog\Block\Product\ProductList\Related" name="catalog.product.related" template="Magento_Catalog::product/list/related.phtml">                  
 <block class="Magento\Framework\View\Element\RendererList" name="related.product.type.details.renderers" as="details.renderers">
    <block class="Magento\Framework\View\Element\Template" as="default"/>
    <block class="Magento\Swatches\Block\Product\Renderer\Listing\Configurable" as="configurable" template="Magento_Swatches::product/listing/renderer.phtml" />
</block>
</block>

To get swatches inside related block i update code in below path:

/app/design/frontend/magento/theme/Magento_Catalog/templates/product/list/related.phtml

add below code to show a configurable option but can not get this.

<div class="product details product-item-details">
  ....
<?php echo $block->getProductDetailsHtml($_item); ?>
2
  • 1
    I think this issue with Magento version. Commented Jun 15, 2019 at 4:35
  • It might be possible because above code working on the latest version of Magento 2.3.0 but not working on 2.2.1 version . Commented Jun 15, 2019 at 4:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.