0

I need to override the shippingmethodmagament.php file which is in the model file in the magento this path vendor\magento\module-quote\Model\ShippingMethodManagement.php

but the interfaces is applied in this file and i have try with the preference but its not properly work

I need to override this function inside the my custom module model please help me out to override this core function enter image description here

7
  • Try using this link it may help magento.stackexchange.com/questions/270381/…
    – Asssd
    2 days ago
  • @Asssd i need to override the getShippingMethods function which is inside this model and that function is a private function 2 days ago
  • 1
    using prefrence will resolve it in above link there were multiple ways plugin and prefrence as you need it for private funciton use prefrence.
    – Asssd
    2 days ago
  • preference is not worked on the interface class 2 days ago
  • What do you mean by "preference is not worked" ? Note that after modifying a constructor (what you are doing with a preference) you need to do a bin/magento setup:di:compile
    – Claims
    2 days ago
1

This is some magento basics that you are missing there.

What you are probably looking for is called preference.

You need to write a preference in the di.xml of your custom module Just replace with the correct path

di.xml

<config>
    <preference for="Magento\..\ShippingMethodManagement" type="Your_Module_Namespace\...\ShippingMethodManagement" />
</config>

Then you can write your own ShippingMethodManagement that extends the magento one.

1
  • I have updated my question please check 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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