Magento 2: Can we call one observer in another observer?
-
06-10-2020 - |
Question
I already have 1 observer on checkout_cart_product_add_after
.
Before end of $this
I woule like to call another observer which is located in different module
magento\app\code\Custom\Module\Observer\AnotherObserver.php
Both are executing on same event. But both files do different functionality that's why want to make it in separate files.
Don't want to merge code of 2 files in 1 file
Solution
In your case, should use <sequence>
in the module.xml
.
Read more here: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/module-load-order.html
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange