5

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

3
  • 1
    if you are creating color/size with configurable product, you can use catalog_product_view_type_configurable.xml instead of catalog_product_view_type_configurable.xml Commented Apr 15, 2019 at 16:57
  • Can you tell me how to move this button between Color and Size? Commented Apr 16, 2019 at 8:58
  • it can be shown above to colour Or below to size. Commented Apr 16, 2019 at 17:00

1 Answer 1

1

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

1
  • Yes, agreed.... Commented Apr 16, 2019 at 17:37

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.