skip to Main Content

i wrote a simple module to override this core Model class, but on frontend it shows this error message:

“Fatal error: Uncaught TypeError: Argument 3 passed to
MagentoQuoteModelQuoteShippingAssignmentShippingProcessor::__construct()
must be an instance of MagentoQuoteModelShippingMethodManagement,
instance of shippingmoduleModelShippingMethodManagementInterceptor
…..”

HERE IS MY ‘di.xml’ file content:

<?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="MagentoQuoteModelShippingMethodManagement" type="shippingmoduleModelShippingMethodManagement" />
</config>

4

Answers


  1. You Need To Do :-

    php bin/magento s:up
    

    And Clean Cache

    Login or Signup to reply.
  2. You need to run below commands after ensuring full permission:

    chmod -R 777 var generated
    php bin/magento setup:di:compile
    php bin/magento cache:flush
    

    If error still persist, check if you are in developer mode by this command:

    php bin/magento deploy:mode:show
    

    set in developer mode :

    php bin/magento deploy:mode:set developer
    

    after setting to developer mode, remove var and generated folder,

    rm -rf var generated
    

    then flush cache :

    php bin/magento cache:flush
    chmod -R 777 var generated
    
    Login or Signup to reply.
  3. Extend your class using the core path of the file as given below.

    In **shippingmoduleModel**

    class ShippingMethodManagement extends 
    MagentoQuoteModelShippingMethodManagement
    {
       //You can write your custom functionality here
    }
    

    Don’t forget to run the following commands after the change.

    chmod -R 777 var generated
    php bin/magento setup:di:compile
    php bin/magento cache:flush
    
    Login or Signup to reply.
  4. After added new Argument in constructor, need to re-created interpreter.So run di :compile command

    php bin/magento setup:di:compile
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search