umbraco / Umbraco.Commerce.Issues

18 stars 2 forks source link

Events for Shipping Method updates #537

Closed MMasey closed 1 week ago

MMasey commented 1 week ago

We have an CRM integration with our Umbraco Commerce site which has a concept of "Products" and "Shipping Types", and in order to log a copy of the orders in to the CRM these need to be set up their already, matching what's in Umbraco (realistically, this only needs to be the SKU, and the name). The Product side should be fairly simple to automate because we can bind with the existing content events, allowing us to create or update products in the CRM based on what is in Umbraco.

Unfortunately I've not found a way to set up a similar sort of event for when Shipping Methods are added or updated.

Describe the solution you'd like When a shipping method is added or updated, we can make used of a Shipping Method or Umbraco Commerce Notification, that provides information about the changes setup in Umbraco Commerce.

Describe alternatives you've considered I've not found another way to do this yet,

mattbrailsford commented 1 week ago

All entities fire at minimum ‘Creating’, ‘Created’, ‘Updating’, ‘Updated’, ‘Saving’, ‘Saved’, ‘Deleting’ and ‘Deleted’ notification events.

These are all in the ‘Umbraco.Commerce.Core.Events.Notification’ namespace and take the naming structure ‘{EntityType}{Event}Notification’ so in your case the entity type is ‘ShippingMethod’ so events would be like ‘ShippingMethodCreatedNotification’.

You can find docs here on how to use Umbraco Commerces event system (it is slightly different to the CMS) https://docs.umbraco.com/umbraco-commerce/key-concepts/events. A list of all notification events can also be found here https://docs.umbraco.com/umbraco-commerce/key-concepts/events/list-of-notification-events

MMasey commented 1 week ago

Ah so it is, I have no idea how I managed to miss that 😅 Thanks @mattbrailsford