how i can override the observer of other modules in magento 2Ordering Modules that both use sales_order_place_after observerI want to use same observer in extension both module what I do?Override same Model/Controller in 2 different modulesHow to override core class which is already overrided by other custom module in Magento 2How to rebuild the modules sequenceHow to call an observer from custom module: Magento 2How can I override template file from non magento core modules?Can I load my module before other modulesMagento 2 How to hide price from front end with custom module?How to override “vendormagentomodule-catalogviewbasewebjsprice-utils.js” in our custom module Magento 2?

Lied on resume at previous job

Shall I use personal or official e-mail account when registering to external websites for work purpose?

Is a car considered movable or immovable property?

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?

Copycat chess is back

What is the offset in a seaplane's hull?

Why does this relative pronoun not take the case of the noun it is referring to?

What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?

Pristine Bit Checking

Travelling to Edinburgh from India

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

Is "plugging out" electronic devices an American expression?

Is domain driven design an anti-SQL pattern?

What does 'script /dev/null' do?

Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?

Extreme, but not acceptable situation and I can't start the work tomorrow morning

Can a planet have a different gravitational pull depending on its location in orbit around its sun?

Are cabin dividers used to "hide" the flex of the airplane?

What to wear for invited talk in Canada

Why is the design of haulage companies so “special”?

Could Giant Ground Sloths have been a Good Pack Animal for the Ancient Mayans

Wild Shape Centaur Into a Giant Elk: do their Charges stack?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Does the average primeness of natural numbers tend to zero?



how i can override the observer of other modules in magento 2


Ordering Modules that both use sales_order_place_after observerI want to use same observer in extension both module what I do?Override same Model/Controller in 2 different modulesHow to override core class which is already overrided by other custom module in Magento 2How to rebuild the modules sequenceHow to call an observer from custom module: Magento 2How can I override template file from non magento core modules?Can I load my module before other modulesMagento 2 How to hide price from front end with custom module?How to override “vendormagentomodule-catalogviewbasewebjsprice-utils.js” in our custom module Magento 2?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0
















how i can override observer of other module(custom module)



to my another custom modules in magento 2



is it possible ???




Does anyone have an idea?



ex :



custom module 1:



the observer for catalog price change



custom module 2:



i want the price of changed by observer in custom module1.










share|improve this question






























    0
















    how i can override observer of other module(custom module)



    to my another custom modules in magento 2



    is it possible ???




    Does anyone have an idea?



    ex :



    custom module 1:



    the observer for catalog price change



    custom module 2:



    i want the price of changed by observer in custom module1.










    share|improve this question


























      0












      0








      0









      how i can override observer of other module(custom module)



      to my another custom modules in magento 2



      is it possible ???




      Does anyone have an idea?



      ex :



      custom module 1:



      the observer for catalog price change



      custom module 2:



      i want the price of changed by observer in custom module1.










      share|improve this question

















      how i can override observer of other module(custom module)



      to my another custom modules in magento 2



      is it possible ???




      Does anyone have an idea?



      ex :



      custom module 1:



      the observer for catalog price change



      custom module 2:



      i want the price of changed by observer in custom module1.







      magento2 module event-observer price






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 5 at 8:30









      Amit Bera

      59.7k1676178




      59.7k1676178










      asked Apr 5 at 7:24









      prabhakaran7prabhakaran7

      30710




      30710




















          3 Answers
          3






          active

          oldest

          votes


















          1














          Yes, you can using preference



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendor1ModuelName1ObserverFileName1" type="Vendor2ModuelName2ObserverFileName2" />
          </config>


          Just copy the existing observer from FileName1.php to
          FileName2.php and do alter the namespace and all. and I hope it works.




          Despite executing first observer it will execute second observer.







          share|improve this answer























          • how to get the product price changed by the observer in another module

            – prabhakaran7
            Apr 5 at 8:06












          • No that's not possible, guess you're setting custom price in quote so you can get quote again and can change it accordingly. that's possible

            – Prathap Gunasekaran
            Apr 5 at 8:11











          • so i need to add discount logic agin in module 2 observer

            – prabhakaran7
            Apr 5 at 8:52


















          0















          Using Preference it's is possible




          etc/di.xml



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendormodule1filelocation" type="Vendormodule2filelocation" />
          </config>





          share|improve this answer























          • i have another doubt

            – prabhakaran7
            Apr 5 at 7:41











          • i have changed the price of product using custom module1(for some discount for customer)

            – prabhakaran7
            Apr 5 at 7:42











          • after another module 2. i will get the price but it's getting Product orignal price not getting discount price

            – prabhakaran7
            Apr 5 at 7:43











          • how i can get that discount price in custom module 2??

            – prabhakaran7
            Apr 5 at 7:44


















          0














          To override an observer, I think better way is to use events.xml rather than using preference.



          Suppose you have events.xml in ModuleA



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyModuleAObserverMyObserver" />
          </event>
          </config>


          Now if you want to override the observer MyCompanyModuleAObserverMyObserver, then create events.xml in your custom module as follows



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyCustomModuleObserverMyObserver" />
          </event>
          </config>


          And in your custom module's(MyCompany_CustomModule) module.xml add sequence of MyCompany_ModuleA



          <?xml version="1.0" encoding="UTF-8" ?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
          <module name="MyCompany_CustomModule">
          <sequence>
          <module name="MyCompany_ModuleA" />
          </sequence>
          </module>
          </config>


          Also, Magento recommends to use plugins for data modification. Observers should not be used for data modifications.






          share|improve this answer























          • some confusions in name of mycomapany_module and custom module could you plz explain clear ly

            – prabhakaran7
            Apr 5 at 9:14











          • @prabhakaran7 MyCompany_ModuleA is the module name that you want to override and MyCompany_CustomModule is the module name that you are using to override the MyCompany_ModuleA

            – Anshu Mishra
            Apr 5 at 9:17











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268874%2fhow-i-can-override-the-observer-of-other-modules-in-magento-2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Yes, you can using preference



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendor1ModuelName1ObserverFileName1" type="Vendor2ModuelName2ObserverFileName2" />
          </config>


          Just copy the existing observer from FileName1.php to
          FileName2.php and do alter the namespace and all. and I hope it works.




          Despite executing first observer it will execute second observer.







          share|improve this answer























          • how to get the product price changed by the observer in another module

            – prabhakaran7
            Apr 5 at 8:06












          • No that's not possible, guess you're setting custom price in quote so you can get quote again and can change it accordingly. that's possible

            – Prathap Gunasekaran
            Apr 5 at 8:11











          • so i need to add discount logic agin in module 2 observer

            – prabhakaran7
            Apr 5 at 8:52















          1














          Yes, you can using preference



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendor1ModuelName1ObserverFileName1" type="Vendor2ModuelName2ObserverFileName2" />
          </config>


          Just copy the existing observer from FileName1.php to
          FileName2.php and do alter the namespace and all. and I hope it works.




          Despite executing first observer it will execute second observer.







          share|improve this answer























          • how to get the product price changed by the observer in another module

            – prabhakaran7
            Apr 5 at 8:06












          • No that's not possible, guess you're setting custom price in quote so you can get quote again and can change it accordingly. that's possible

            – Prathap Gunasekaran
            Apr 5 at 8:11











          • so i need to add discount logic agin in module 2 observer

            – prabhakaran7
            Apr 5 at 8:52













          1












          1








          1







          Yes, you can using preference



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendor1ModuelName1ObserverFileName1" type="Vendor2ModuelName2ObserverFileName2" />
          </config>


          Just copy the existing observer from FileName1.php to
          FileName2.php and do alter the namespace and all. and I hope it works.




          Despite executing first observer it will execute second observer.







          share|improve this answer













          Yes, you can using preference



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendor1ModuelName1ObserverFileName1" type="Vendor2ModuelName2ObserverFileName2" />
          </config>


          Just copy the existing observer from FileName1.php to
          FileName2.php and do alter the namespace and all. and I hope it works.




          Despite executing first observer it will execute second observer.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 5 at 7:33









          Prathap GunasekaranPrathap Gunasekaran

          1,7611618




          1,7611618












          • how to get the product price changed by the observer in another module

            – prabhakaran7
            Apr 5 at 8:06












          • No that's not possible, guess you're setting custom price in quote so you can get quote again and can change it accordingly. that's possible

            – Prathap Gunasekaran
            Apr 5 at 8:11











          • so i need to add discount logic agin in module 2 observer

            – prabhakaran7
            Apr 5 at 8:52

















          • how to get the product price changed by the observer in another module

            – prabhakaran7
            Apr 5 at 8:06












          • No that's not possible, guess you're setting custom price in quote so you can get quote again and can change it accordingly. that's possible

            – Prathap Gunasekaran
            Apr 5 at 8:11











          • so i need to add discount logic agin in module 2 observer

            – prabhakaran7
            Apr 5 at 8:52
















          how to get the product price changed by the observer in another module

          – prabhakaran7
          Apr 5 at 8:06






          how to get the product price changed by the observer in another module

          – prabhakaran7
          Apr 5 at 8:06














          No that's not possible, guess you're setting custom price in quote so you can get quote again and can change it accordingly. that's possible

          – Prathap Gunasekaran
          Apr 5 at 8:11





          No that's not possible, guess you're setting custom price in quote so you can get quote again and can change it accordingly. that's possible

          – Prathap Gunasekaran
          Apr 5 at 8:11













          so i need to add discount logic agin in module 2 observer

          – prabhakaran7
          Apr 5 at 8:52





          so i need to add discount logic agin in module 2 observer

          – prabhakaran7
          Apr 5 at 8:52













          0















          Using Preference it's is possible




          etc/di.xml



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendormodule1filelocation" type="Vendormodule2filelocation" />
          </config>





          share|improve this answer























          • i have another doubt

            – prabhakaran7
            Apr 5 at 7:41











          • i have changed the price of product using custom module1(for some discount for customer)

            – prabhakaran7
            Apr 5 at 7:42











          • after another module 2. i will get the price but it's getting Product orignal price not getting discount price

            – prabhakaran7
            Apr 5 at 7:43











          • how i can get that discount price in custom module 2??

            – prabhakaran7
            Apr 5 at 7:44















          0















          Using Preference it's is possible




          etc/di.xml



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendormodule1filelocation" type="Vendormodule2filelocation" />
          </config>





          share|improve this answer























          • i have another doubt

            – prabhakaran7
            Apr 5 at 7:41











          • i have changed the price of product using custom module1(for some discount for customer)

            – prabhakaran7
            Apr 5 at 7:42











          • after another module 2. i will get the price but it's getting Product orignal price not getting discount price

            – prabhakaran7
            Apr 5 at 7:43











          • how i can get that discount price in custom module 2??

            – prabhakaran7
            Apr 5 at 7:44













          0












          0








          0








          Using Preference it's is possible




          etc/di.xml



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendormodule1filelocation" type="Vendormodule2filelocation" />
          </config>





          share|improve this answer














          Using Preference it's is possible




          etc/di.xml



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
          <preference for="Vendormodule1filelocation" type="Vendormodule2filelocation" />
          </config>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 5 at 7:32









          Ronak RathodRonak Rathod

          1,217213




          1,217213












          • i have another doubt

            – prabhakaran7
            Apr 5 at 7:41











          • i have changed the price of product using custom module1(for some discount for customer)

            – prabhakaran7
            Apr 5 at 7:42











          • after another module 2. i will get the price but it's getting Product orignal price not getting discount price

            – prabhakaran7
            Apr 5 at 7:43











          • how i can get that discount price in custom module 2??

            – prabhakaran7
            Apr 5 at 7:44

















          • i have another doubt

            – prabhakaran7
            Apr 5 at 7:41











          • i have changed the price of product using custom module1(for some discount for customer)

            – prabhakaran7
            Apr 5 at 7:42











          • after another module 2. i will get the price but it's getting Product orignal price not getting discount price

            – prabhakaran7
            Apr 5 at 7:43











          • how i can get that discount price in custom module 2??

            – prabhakaran7
            Apr 5 at 7:44
















          i have another doubt

          – prabhakaran7
          Apr 5 at 7:41





          i have another doubt

          – prabhakaran7
          Apr 5 at 7:41













          i have changed the price of product using custom module1(for some discount for customer)

          – prabhakaran7
          Apr 5 at 7:42





          i have changed the price of product using custom module1(for some discount for customer)

          – prabhakaran7
          Apr 5 at 7:42













          after another module 2. i will get the price but it's getting Product orignal price not getting discount price

          – prabhakaran7
          Apr 5 at 7:43





          after another module 2. i will get the price but it's getting Product orignal price not getting discount price

          – prabhakaran7
          Apr 5 at 7:43













          how i can get that discount price in custom module 2??

          – prabhakaran7
          Apr 5 at 7:44





          how i can get that discount price in custom module 2??

          – prabhakaran7
          Apr 5 at 7:44











          0














          To override an observer, I think better way is to use events.xml rather than using preference.



          Suppose you have events.xml in ModuleA



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyModuleAObserverMyObserver" />
          </event>
          </config>


          Now if you want to override the observer MyCompanyModuleAObserverMyObserver, then create events.xml in your custom module as follows



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyCustomModuleObserverMyObserver" />
          </event>
          </config>


          And in your custom module's(MyCompany_CustomModule) module.xml add sequence of MyCompany_ModuleA



          <?xml version="1.0" encoding="UTF-8" ?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
          <module name="MyCompany_CustomModule">
          <sequence>
          <module name="MyCompany_ModuleA" />
          </sequence>
          </module>
          </config>


          Also, Magento recommends to use plugins for data modification. Observers should not be used for data modifications.






          share|improve this answer























          • some confusions in name of mycomapany_module and custom module could you plz explain clear ly

            – prabhakaran7
            Apr 5 at 9:14











          • @prabhakaran7 MyCompany_ModuleA is the module name that you want to override and MyCompany_CustomModule is the module name that you are using to override the MyCompany_ModuleA

            – Anshu Mishra
            Apr 5 at 9:17















          0














          To override an observer, I think better way is to use events.xml rather than using preference.



          Suppose you have events.xml in ModuleA



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyModuleAObserverMyObserver" />
          </event>
          </config>


          Now if you want to override the observer MyCompanyModuleAObserverMyObserver, then create events.xml in your custom module as follows



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyCustomModuleObserverMyObserver" />
          </event>
          </config>


          And in your custom module's(MyCompany_CustomModule) module.xml add sequence of MyCompany_ModuleA



          <?xml version="1.0" encoding="UTF-8" ?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
          <module name="MyCompany_CustomModule">
          <sequence>
          <module name="MyCompany_ModuleA" />
          </sequence>
          </module>
          </config>


          Also, Magento recommends to use plugins for data modification. Observers should not be used for data modifications.






          share|improve this answer























          • some confusions in name of mycomapany_module and custom module could you plz explain clear ly

            – prabhakaran7
            Apr 5 at 9:14











          • @prabhakaran7 MyCompany_ModuleA is the module name that you want to override and MyCompany_CustomModule is the module name that you are using to override the MyCompany_ModuleA

            – Anshu Mishra
            Apr 5 at 9:17













          0












          0








          0







          To override an observer, I think better way is to use events.xml rather than using preference.



          Suppose you have events.xml in ModuleA



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyModuleAObserverMyObserver" />
          </event>
          </config>


          Now if you want to override the observer MyCompanyModuleAObserverMyObserver, then create events.xml in your custom module as follows



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyCustomModuleObserverMyObserver" />
          </event>
          </config>


          And in your custom module's(MyCompany_CustomModule) module.xml add sequence of MyCompany_ModuleA



          <?xml version="1.0" encoding="UTF-8" ?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
          <module name="MyCompany_CustomModule">
          <sequence>
          <module name="MyCompany_ModuleA" />
          </sequence>
          </module>
          </config>


          Also, Magento recommends to use plugins for data modification. Observers should not be used for data modifications.






          share|improve this answer













          To override an observer, I think better way is to use events.xml rather than using preference.



          Suppose you have events.xml in ModuleA



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyModuleAObserverMyObserver" />
          </event>
          </config>


          Now if you want to override the observer MyCompanyModuleAObserverMyObserver, then create events.xml in your custom module as follows



          <?xml version="1.0"?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
          <event name="some_event">
          <observer name="myObserverName" instance="MyCompanyCustomModuleObserverMyObserver" />
          </event>
          </config>


          And in your custom module's(MyCompany_CustomModule) module.xml add sequence of MyCompany_ModuleA



          <?xml version="1.0" encoding="UTF-8" ?>
          <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
          <module name="MyCompany_CustomModule">
          <sequence>
          <module name="MyCompany_ModuleA" />
          </sequence>
          </module>
          </config>


          Also, Magento recommends to use plugins for data modification. Observers should not be used for data modifications.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 5 at 9:10









          Anshu MishraAnshu Mishra

          5,65652662




          5,65652662












          • some confusions in name of mycomapany_module and custom module could you plz explain clear ly

            – prabhakaran7
            Apr 5 at 9:14











          • @prabhakaran7 MyCompany_ModuleA is the module name that you want to override and MyCompany_CustomModule is the module name that you are using to override the MyCompany_ModuleA

            – Anshu Mishra
            Apr 5 at 9:17

















          • some confusions in name of mycomapany_module and custom module could you plz explain clear ly

            – prabhakaran7
            Apr 5 at 9:14











          • @prabhakaran7 MyCompany_ModuleA is the module name that you want to override and MyCompany_CustomModule is the module name that you are using to override the MyCompany_ModuleA

            – Anshu Mishra
            Apr 5 at 9:17
















          some confusions in name of mycomapany_module and custom module could you plz explain clear ly

          – prabhakaran7
          Apr 5 at 9:14





          some confusions in name of mycomapany_module and custom module could you plz explain clear ly

          – prabhakaran7
          Apr 5 at 9:14













          @prabhakaran7 MyCompany_ModuleA is the module name that you want to override and MyCompany_CustomModule is the module name that you are using to override the MyCompany_ModuleA

          – Anshu Mishra
          Apr 5 at 9:17





          @prabhakaran7 MyCompany_ModuleA is the module name that you want to override and MyCompany_CustomModule is the module name that you are using to override the MyCompany_ModuleA

          – Anshu Mishra
          Apr 5 at 9:17

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268874%2fhow-i-can-override-the-observer-of-other-modules-in-magento-2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Sum ergo cogito? 1 nng

          419 nièngy_Soadمي 19bal1.5o_g

          Queiggey Chernihivv 9NnOo i Zw X QqKk LpB