I just created my first plugin to implement some business logic every time an order goes into Paid status. The plugin is loaded in the admin site and installed but the event is firing exactly 7 times no matter what I do. Is there something I'm doing wrong with plugin registration or is it normal behavior for events to fire this many times?
Normal. If you look at OrderService.cs, method UpdateOrder - note it publishes the event. Right click method name and "Find all References", you will see 70+. Even during the normal order process, it gets called multiple times as parts of the order info are updated from page to page (shipping, payment, address selection, etc.)
I suggest you move this line to the top of your method
if (eventMessage.Entity.PaymentStatus == Core.Domain.Payments.PaymentStatus.Paid)
Makes sense. I was so preoccupied getting the plugin to work I didn't realize I was consuming the wrong event. I switched it to OrderPaidEvent and it fires once as expected.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.