Skip to content

Magento 2.4 override core php file GuestPaymentInformationManagement.php

I want to override vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php. I made a di.xml in app/code/Jilco/Qtybug/etc/ like this:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoCheckoutModelGuestPaymentInformationManagement" type="JilcoQtybugModelGuestPaymentInformationManagement" />
</config>

And the GuestPaymentInformationManagement.php in /home/jilco/public_html/app/code/Jilco/Qtybug/Model/

Also dit the deployement steps

rm -rf generated/code/*
php bin/magento cache:flush 
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento setup:static-content:deploy nl_NL
php bin/magento indexer:reindex
php bin/magento cache:clean

But the file is not replaced, what is wrong?