Advanced license required
Features described on this page require the Xperience by Kentico Advanced license tier.
Order statuses represent stages in the lifecycle of orders created by your store's customers (New, Payment received, Shipped, Delivered, etc.).
You can set up two types of notifications about order status changes:
Customer order notifications are based on emails in email channels.
Dedicated commerce email channel
If possible, we recommend setting up a separate dedicated email channel for your commerce-related emails. This allows you to:
You can create any number of customer notification emails and use a different one for every order status.
Create an email.
Prepare the email's content:
Publish the email.
The system uses a single notification template for internal order notifications. To define the content:
Prerequisite
Make sure that the service domain for notifications is set up in your project. For projects deployed in the Xperience by Kentico SaaS environment, the service domain is configured automatically.
Navigate to the Notifications application.
Select the Commerce order default notification and edit the email content.
Save the changes.
Now you need to enable the notification for individual order statuses:
Order notifications (both for customers and internal) are automatically sent when moving existing orders between order statuses. If you want the system to send notifications when a new order is created, you need to call the SendNotification method of the IOrderNotificationService service when creating the order.
using System.Threading;
using System.Threading.Tasks;
using CMS.Commerce;
using Microsoft.Extensions.Logging;
// Gets an instance of IOrderNotificationService using dependency injection
public class OrderComponent(IOrderNotificationService orderNotificationService, ILogger<OrderComponent> logger)
{
public async Task CreateOrder(CancellationToken cancellationToken)
{
// Creates a new order object
var order = new OrderInfo()
{
// Create and populate the order object
// ...
};
// Create and populate the order address (OrderAddressInfo) and order items (OrderItemInfo)
// ...
try
{
// Sends notifications about the created order (both for customers and internal)
await orderNotificationService.SendNotification(order.OrderID, cancellationToken);
}
catch (OrderNotificationSendException ex)
{
// We strongly recommend using a logger service (e.g., ILogger) to detect errors that could occur when sending order notifications
logger.LogError(ex, "Failed to send notification for order ID {OrderID}", order.OrderID);
}
}
}