I'm working on a Magento 2.2.3 B2B, with the Quick Order feature enabled, and I can't find a way to extend a method of the Magento\QuickOrder\Model\Cart model.

So far I tried the usual: MyCompany/MyModule/etc/di.xml:

<preference for="Magento\QuickOrder\Model\Cart"

and then in MyCompany\MyModule\Model\Cart.php:

namespace MyCompany\MyModule\Model;

class Cart extends \Magento\QuickOrder\Model\Cart
    protected function _addAffectedItem($item, $code)
        // My extended code

But it's not working. I also tried using a plugin, but for some reason my code is being ignored. Any ideas of what's going on with this Model?

Thanks in advance

1 Answer 1


Use before methods if you want your code to be executed first. Just follow along this documentation: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html

  • Thank you but as I mentioned I tried using before and after plugins, but those are being ignored also. It looks like some other Model is overriding all of my changes.
    – pinicio
    Feb 4, 2019 at 17:32

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.