I want to remove some portion from di.xml of vendor module. Below example of some portion that to be removed.
<type name="MagentoBraintreeBlockGooglePayShortcutButton">
<arguments>
<argument name="data" xsi:type="array">
<item name="template" xsi:type="string">Magento_Braintree::googlepay/shortcut.phtml</item>
<item name="alias" xsi:type="string">braintree.googlepay.mini-cart</item>
<item name="button_id" xsi:type="string">braintree-googlepay-mini-cart</item>
</argument>
<argument name="payment" xsi:type="object">BraintreeGooglePay</argument>
</arguments>
</type>
How can I remove the it using override of di.xml in custom module.
2
Answers
Thanks for sharing the possible options.
The solution that did work for me is to make the item inside argument tag to null. In my scenario, I do not want this item in dependency injection. That works for me.
Below code added in custom module etc/frontend/di.xml
Have you tried putting
Inside custom
di.xml
?Then run
php bin/magento setup:upgrade
, so that dependencies are updated.To remove the button completely, search for occurences of the block class and create own layout file(-s) in custom module (
Vendor/Module/view/frontend/layout/{{THE_LAYOUT_NAME}}.xml
) with following content:EDIT: The button block name is defined within the layout files by the
name
attribute of<block>
tag.