Using Notification Templates¶
Notifications are automated emails sent to users. To send email notifications, first create a Notification Template. Notification Templates define the notification sender, trigger, and content of an email notification. See the Store Emails article for a complete list of available Notification Templates.
Note
To use Liferay Commerce’s Notifications feature, first configure the Mail settings for Liferay Digital Experience Platform (DXP). See Configuring Mail for more information.
Creating a Notification¶
Follow these steps to create a notification for a received order:
Navigate to the Control Panel → Commerce → Channels.
Click on the desired channel.
Click the Notifications tab.
Click the Notification Templates sub-tab.
Click the Add (
) button to create a new Notification Template.
Enter the following:
Name: New Orders
Description: New orders template
Type: Order Placed
Enabled: Switch the Toggle to YES.
From Address: Your store’s email address (for example: orders@yourstore.com)
From Name: Name of the store or a customer service representative
Subject: Email subject (for example: Your order has been received.)
Body: Enter a message. You can use variables such as
[%ORDER_CREATOR%]
and[%ORDER_ID%]
to represent a customer’s name and order ID respectively. See the Notification Template Variables Reference Guide to learn more.
Click Save.
The new Notification Template has been saved and your store now sends an automated email to buyers upon receiving an order.
Example: Using Placeholder Values¶
When creating an Email Notification Template, you can use a comma-delimited list of variables as a substitute for key values in the Email Content’s Email Settings and Body fields. Key values include a customer’s name, the Order ID, shipping and billing addresses, and a list of items in the order.
You can use placeholder variables in the Email Settings and Email Body sections. In this example we create an email template notification to confirm the receipt of an order.
Email Settings¶
To define the recipient, sender address, and sender name, enter the following:
to:
[%ORDER_CREATOR%]
From Address: orders@sahara.com
From Name:
[%ACCOUNT_ROLE_ORDER_MANAGER%]
If notifying more than one recipient, as noted above, you can a comma-delimited list by entering in the to field: [%ORDER_CREATOR%]
,[%ACCOUNT_ROLE_ADMINISTRATOR%]
. This sends the email to the person who placed the order and the account administrator.
Email Body¶
To define the content of the notification, enter the following:
Subject: Order Received
Body:
Dear `[%ORDER_CREATOR%]`, Your Order `[%ORDER_ID%]` has been received. Regards, `[%ACCOUNT_ROLE_ORDER_MANAGER%]`
Commerce 2.0 and Below¶
To create email notifications in Commerce 2.0 and below:
Navigate to Site Administration → Commerce → Settings.
Click the Notifications tab.
Click the Notification Templates sub-tab.
Click the Add (
) button to create a new Notification Template.
Enter the following:
Name: New Orders
Description: New orders template
Account Groups: (leave blank or designate an optional account group)
From Address: Your store’s email address (for example: orders@yourstore.com)
From Name: Name of the store or a customer service representative
Type: Order Placed
Enabled: Switch the Toggle to YES
Subject: Email subject (for example: Your order has been received.)
Body: You can use variables such as
[%ORDER_CREATOR%]
and[%ORDER_ID%]
to represent a customer’s name and order ID respectively. See the Notification Template Variables Reference Guide to learn more.
Click Save.
The new Notification Template has been saved and your store will send an automated email to buyers after the store has received their order. Once the template is created, a new notification is added to the notification queue whenever an order is placed. Check the Notifications Queue sub-tab when an order has been placed. By default, Liferay Commerce checks the queue every 15 minutes to send any unsent notifications. To learn how to change the interval, see Configuring the Commerce Notification Queue.