QuestionQ13

Developing with Admin

An Adobe Commerce developer has installed a module supplied by a third-party vendor. The module dispatches a custom event named third_party_event_after and defines an observer named third_party_event_after_observer that listens for that event. The developer wants to listen for this custom event from their own module, but needs their observer’s logic to run after the third_party_event_after_observer observer has completed.

What should the developer do to ensure that their observer runs after the observer defined by the third-party module?

  • A Ensure the third-party module is listed in the <sequence> node of the developer's module.xml file.
  • B Set the sortOrder of the new observer to be less than that of the third-party vendor's observer.
  • C This is not possible as observers listening to the same event may be invoked in any order.
Explanation

A module’s <sequence> declaration causes the listed third-party module to load before the developer’s module. Adobe Commerce merges event observer configuration according to module load order, so the developer’s distinct observer declaration is processed after the third-party observer and is invoked afterward.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!