Integrate Hook before (!) event is emitted #11134
fxmb
started this conversation in
Feature Requests
Replies: 1 comment
-
In above example I will just access the carts metadata through the order object (order.cart.metadata) but I ran across this issue mutliple times. E.g. customer.created where we execute some additional checks (email verification, assign to company team etc). We would again like to emit the event AFTER these checks have passed |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I often come across workflows where I would like to inject a hook before (!) the event is triggered.
Example:
Order Placed workflow. I want to transfer the carts metadata to the orders metadata. I would like to inject this hook before the
order.placed
event is triggered so that all subscribers to this event reliably know that the carts metadata is present on the order object.I could of course inject the metadata with a subscriber to
order.placed
and then emit another event such asorder.placed_and_metadata_added
that all other relevant subscribers would listen to but this is obviously pretty dirty and error prone.Is this possible or is there a reason I cannot do that?
Would be awesome for these hooks to set an option "emitEventAfter": bool that determines whether the hook is executed before or after the event is emitted.
Beta Was this translation helpful? Give feedback.
All reactions