问题
I've overridden \Magento\Checkout\Block\Cart\Item\Renderer
and when I add this to the end of config in /app/etc/di.xml
the override works.
<preference for="Magento\Checkout\Block\Cart\Item\Renderer" type="Tls\Module\Block\Cart\Item\Renderer" />
However, when I try to use /app/code/Tls/Module/etc/di.xml
there is no effect. This is the contents of my di.xml
(though I've tried many things)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Checkout\Block\Cart\Item\Renderer" type="Tls\Module\Block\Cart\Item\Renderer" />
</config>
Magento 2.2.4
来源:https://stackoverflow.com/questions/50765183/why-is-my-magento2-di-xml-not-having-any-effect