How to Create a Dynamic Product Recommendation Email in Salesforce Marketing Cloud (SFMC)

What you will learn: How to create a Salesforce Marketing Cloud email template that populates Digioh-collected product recommendation values dynamically.

If you are setting up a Digioh integration by yourself, we first recommend reading Digioh Integration Basics.

What is required: Your account must be integrated with Salesforce Marketing Cloud using either of the following methods:

After completing the integration with Digioh and ensuring data is passing to the SFMC account, follow these steps to create your dynamic email template in SFMC.

Step 1: Log into your SFMC account, go to the “content builder” option, and select “content builder” from the dropdown list.

salesforce marketing cloud Content builder

Step 2: Go to Create > Email Template. Then choose either the ‘Paste HTML’ or ‘From Existing Template’ option.

Create Email Template in SFMC

In this example, we’ll choose the “Paste HTML” option.

Step 3: Go to the ‘Content’ option after creating the template.

Email Content in SFMC

From there, you can add content using ‘Blocks’. Drag and drop blocks as required. You can also use the ‘HTML’ block to create the template UI.

Step 4: Under ‘Advanced Content’ there is an option for ‘Dynamic Content.’ Use this block to dynamically decide when to show the box and when not to. You can achieve the dynamic display of the box also by using a simple ‘HTML’ block option.

Adding dynamic content to email

Step 5: Let’s create Dynamic Content using an HTML block. The example HTML code below will show the product recommendation only if its data is being passed to the SFMC data extension.


%%[
Set @productOneName = product_one_name
Set @productOneCategory = product_one_category
Set @productOneImage= product_one_image
Set @productOnePrice = product_one_price
Set @productOneQuantity = product_one_quantity
Set @productTwoName = product_two_name
Set @productTwoCategory = product_two_category
Set @productTwoImage= product_two_image
Set @productTwoPrice = product_two_price
Set @productTwoQuantity = product_two_quantity
]%%
<h3>Product Details</h3>
%%[ if not Empty(@productOneName) THEN ]%%
<ul>
   <li>Name : %%= v(@productOneName) =%%</li>
   <li>Category: %%= v(@productOneCategory) =%%</li>
   <li>Image: <img src="%%= v(@productOneImage) =%%" alt="" /></li>
   <li>Price: %%= v(@productOnePrice) =%%</li>
   <li>Quantity: %%= v(@productOneQuantity) =%%</li>
</ul>
%%[ENDIF]%%
%%[ if not Empty(@productTwoName) THEN ]%%
<ul>
   <li>Name : %%= v(@productTwoName) =%%</li>
   <li>Category: %%= v(@productTwoCategory) =%%</li>
   <li>Image: <img src="%%= v(@productTwoImage) =%%" alt="" /></li>
   <li>Price: %%= v(@productTwoPrice) =%%</li>
   <li>Quantity: %%= v(@productTwoQuantity) =%%</li>
</ul>
%%[ENDIF]%%

____________

Here is a PDF breakdown of the HTML

To get more details on the dynamic variables and their usage in SFMC, consult the SFMC documentation for an in-depth overview.

Once the email template is created, go to the “Preview and Test” option to start testing how the template will dynamically look when specific data is passed to it.

Preview and test SFMC email with dynamic content

Finishing touch: Once everything is done, you can start building your Email Journey to automate your sending process.

Consult the SFMC documentation to learn how to successfully create an Email Journey.

Have any questions about creating dynamic email templates in SFMC for product recommendations? Send us an email, and we’ll be glad to help!