Configuring an email rendering to output product content

Current version: 10.1

This topic focuses on product recommendations but you can use the Email product recommendations rendering in other scenarios. With the SXA Storefront site template, by default, a recommended products email message is sent as part of the New Order Placed marketing automation campaign. This email message uses the Email product recommendations rendering, which is configured by default to use the shop name and order ID, or cart ID, custom values. The products that are proposed are determined based on the purchase history, the relationships defined in the catalog, or a list of products returned when executing a query against the catalog.

Example of a product recommendation email message body.

The rendering is implemented in a generic way to address multiple scenarios so that it accepts a list of product IDs and renders product content based on them. For example:

  • If you want to render a list of products in the email message based on a query, you can use the default implementation with a query configured as a parameter.

  • If you want to render content for a single product in a more descriptive way than showing a product, you must change the MVC View to select the first product returned from the configured query and output the markup you want.

For more advanced scenarios, you can override the virtual method in the rendering repository that retrieves the list of product IDs or inject custom pipeline processors to process and return a list of product IDs. You can also add additional parameters to the rendering.

As shown in the marketing automation campaign data flow, when customers submit an order, they are enrolled in the New Order Placed marketing automation campaign, which by default includes custom values (shop name and Order ID). When the Send Commerce Email marketing automation action is encountered, the custom values are passed to the Email Experience Manager (EXM) using the Message Bus. Then, when EXM starts to render the content of the email message, the shop name and order ID are passed onto the rendering as query parameters.

Note

For the Abandoned Cart marketing automation campaign, the shop name and Cart ID are used.

Email Experience Manager Edit email body dialog box

The Email product recommendations rendering retrieves additional parameters from the data source for the rendering. The parameter item is based on the Recommended Products Email Parameters template (/sitecore/Templates/Feature/Commerce Experience Accelerator/Emails/Products/Email recommended products) and contains the fields detailed in the following table. If you require other custom parameters, you can use a customized copy of the default rendering parameter template.

Fields

Description

Product Page Link Text

Text used for the go to product page button in the HTML markup.

Products query

The query used if an order ID is not passed in by EXM as a query parameter. See the GetRecommendedProducts pipeline.

Max number of recommended products

The maximum number of retrieved and rendered products.

Related products field name

The name of a relationship field as defined in the catalog and exposed in content where the recommended products are stored and retrieved from. If no value is specified, the fallback is to use the relationship field RelatedSellableItemToSellableItem.

Note

You can define any number of custom relationships in the catalog and expose them in content where they can be used for product recommendations. By default, four relationship fields are defined.

Do you have some feedback for us?

If you have suggestions for improving this article,