0

I want to overwrite validateMinimumAmount function that is available in Magento\Quote\Model\Quote class.

Below is my di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\Quote\Model\Quote" type="Myname\Minamount\Model\Quote" />
</config>

below is my preference class:

namespace Myname\Minamount\Model;

class Quote extends Magento\Quote\Model\Quote
{

    public function validateMinimumAmount($multishipping = false)
    {
      // here my logic is going 
    }
}

At the time of di compile it is showing below error:

Class 'Myname\Minamount\Model\Magento\Quote\Model\Quote' not found#

Magento version : 2.4.3-p1

Thanks

2
  • Hi Sanjeev the code you share in this question is not clear can you please check and intimate again ? Because cannot see the namespace of the PHP file and di.xml file code is also missing. Commented Sep 15, 2022 at 16:02
  • Can you attach the di.xml code again? I can't see it.
    – Aaron Wang
    Commented Sep 16, 2022 at 5:23

1 Answer 1

0

Your preference class need to like this.

namespace Myname\Minamount\Model;

class Quote extends \Magento\Quote\Model\Quote
{

    public function validateMinimumAmount($multishipping = false)
    {
      // here my logic is going 
    }
}

Then run all magento commands and then check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.