0

I have two modules:

  1. Vendor_Module1
  2. Vendor_Module2

In either module I'm going to extend \Magento\Directory\Model\Currency to override different methods

I noticed that only one module can override this class at the same time. The module that is placed lower in config.php will have precedence.

I guess something goes wrong. Till now I was absolutely sure that there is no any limitation on how many modules override any class. Who can tell me what I missed?

(Each module overrides its own methods. Of course every time I clear cache, delete generated/code and so on)

It's Magento 2.3.0 if it makes any difference

0

Plugin is best for this one. As it has a sortOrder for prioritizing plugins. check documentation

https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html

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.