How to override a class in magento 2.1 [closed]
-
15-04-2021 - |
Question
hello everyone i am using magento 2.1 in my case i want to override a model class in my custom module , but the override didn't toke correctly
Solution
If You don't want to change existing Statuses, just add new.
You should use DI for that with afterToOptionArray(\Magento\Sales\Model\Config\Source\Order\Status $subject, array $result)
.
and inside just prepare and add new status to $result array. And of course return it.
How To use DI? It's pretty simple. Just read
https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange