I am trying to extend the Magento\Catalog\Block\Product\ListProduct block in Magento 2.1 My Vendor_ModuleName module has the registration.php, the etc/module.xml and it's enabled.
Then I add an etc/di.xml file with the following content:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Catalog\Block\Product\ListProduct" type="Vendor\ModuleName\Block\Product\ListProduct" /> </config>
I expect the rendering of the catalog listing to break because my module block has not yet been created, however, my catalog seems to render as usual.
Indeed, no matter what I put in my Vendor\ModuleName\Block\Product\ListProduct class, it's completely ignored, and this is confirmed by enabling template and block name hints on the storefront: The output block is Magento\Catalog\Block\Product\ListProduct
What is it that I've missed here?