Documentation

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:

  1. Navigate to the Control PanelCommerceChannels.

    Commerce 2.1 Channels

  2. Click on the desired channel.

  3. Click the Notifications tab.

  4. Click the Notification Templates sub-tab.

  5. Click the Add (Add icon) button to create a new Notification Template.

  6. 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.

    Adding a Notification Template in 2.1

  7. Click Save.

The new Notification Template has been saved and your store now sends an automated email to buyers upon receiving an order.

Check the Notification Queue for all outgoing emails.

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%]

Using placeholder values in the emails.

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:

  1. Navigate to Site AdministrationCommerceSettings.

    Commerce 2.0 Site Settings

  2. Click the Notifications tab.

  3. Click the Notification Templates sub-tab.

  4. Click the Add (Add icon) button to create a new Notification Template.

  5. 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.

    Adding a Notification Template

  6. 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.