A while ago I successfully hid the checkmo payment method from frontend only by setting the variable canUseCheckout
to false via preference:
-- V/M/etc/di.xml
<preference for="MagentoOfflinePaymentsModelCheckmo" type="VMModelCheckmo" />
-- V/M/Model/Checkmo.php
class Checkmo extends MagentoOfflinePaymentsModelCheckmo {
protected $_canUseInternal = true;
protected $_canUseCheckout = false;
}
This has always worked fine until recently when we have upgraded our magento from 244 version to 246 and we also switched from cloud to community.
I don’t know if it was the upgrade or the migration from cloud to community, but this preference is not working anymore. More than that, the preference gets ignored completely:
class Checkmo extends MagentoOfflinePaymentsModelCheckmo
{
protected $_canUseInternal = true;
protected $_canUseCheckout = false;
public function canUseCheckout() // this method is never called, only the original method from magento Checkmo class.
{
//return $this->_canUseCheckout;
return false;
}
Is there a way to have this working again?