Skip to content

Override di.xml OR Exclude a code part to be added in generatedmetadataglobal.php

Basically I want to make magento default store credit(Magento_CustomerBalance) to be enable/disable at website level scope(by default its global level)

I have overirded & made changes in certain files which then, it works well on store front for website level, but on magneto admin it does not work as expected

ie. on admin customer edit it dosnt show me store credit tab, even if the customer is from website on which store credit is enabled, Also on admin order pages, store credit is not getting included in totals

So as per my findings, in vendormagentomodule-customer-balanceetcdi.xml there is a part of code

<type name="MagentoFrameworkModuleManager">
    <arguments>
        <argument name="outputConfigPaths" xsi:type="array">
            <item name="Magento_CustomerBalance" xsi:type="const">MagentoCustomerBalanceHelperData::XML_PATH_ENABLED</item>
        </argument>
    </arguments>
</type>

if I remove it entirely(from magento core module’s di.xml) & run di:compile the autogenerated file, generatedmetadataglobal.php will be not having below code

'Magento_CustomerBalance' => 'customer/magento_customerbalance/is_enabled',

Then my customization is working well, So inshort either I want to
override di.xml & would like to pass certain argument which then exclude it as global constant
OR even if thats not possible
When auto generation happens I would like to skip to be added(excluded)

'Magento_CustomerBalance' => 'customer/magento_customerbalance/is_enabled',

in autogenerated global.php
But somehow not able to find, how to achieve this