Pregunta

I want to add a button only on those products which are having product size.Button displaying over Color attribute.enter image description here

My XML file is catalog_product_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

<body>
    <referenceBlock name="product.info.main">
        <block class="VENDOR\MODULE\Block\Button" name="myButton" template="VENDOR_MODULE::button.phtml" />
    </referenceBlock>    
</body>
</page>

Right now it is displaying on all products. Thanks in Advance

¿Fue útil?

Solución

If you are creating color/size with configurable product, you can use catalog_product_view_type_configurable.xml instead of catalog_product_view.xml

It will only applicable to configurable product

Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top