Skip to content

getStatusHistoryCollection missing latest comments in plugin/interceptor

I have a plugin/interceptor hooking into a Vendor webhook function.
This vendor webhook handler has an MagentoSalesModelOrder model where they add comments through the addStatusHistoryComment function.

When my plugin function is called, I then call $order->getStatusHistoryCollection(true), to receive the comments. However the comments that are added by the Vendor webhook function are not shown, only previous comments.

I thought by passing the true boolean to the getStatusHistoryCollection the collection would ‘reload’ but that still doesn’t include the missing comments.

Any idea how to tackle this problem?