cancel
Showing results for 
Search instead for 
Did you mean: 

Display color swatches in related products section

Display color swatches in related products section

How i can do that and also make quick tocart adding with choosed swatch (in related, of course)

1 REPLY 1

Re: Display color swatches in related products section

Okay now I'm change a code little bit and swathces displays in related products section

That my changes in Magento_Catalog/layout

      <referenceContainer name="content">
            <referenceBlock name="catalog.product.related">
                <action method="setTemplate">
                    <argument name="template" xsi:type="string">Magento_Catalog::product/list/items.phtml</argument>
                </action>
                <block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
                    <block class="Magento\Swatches\Block\Product\Renderer\Listing\Configurable" as="configurable" template="Magento_Swatches::product/listing/renderer.phtml" />
                </block>
            </referenceBlock>
        </referenceContainer>

But now swatches ajax image changing won't work. I clicking on another swatch but nothing happens. Also console give me 

jquery.js:9666 XHR failed loading: POST "http://mydomain.com/swatches/ajax/media/".

Can anyone help me with this?