0

I need to provide a custom message when someone buys a specific product in their email confirmation. I have a field in the product channel called {Message_to_Customer} How do I include this field in the email customer email template?

1 Answer 1

0

In your order email template you would need to use the items loop to loop through each item then pass the entry_id to a channel entries tag something similar to:

{exp:store:orders}
<h1>{order_id} - {order_date format="%Y-%d-%m"}</h1>
{items}
 {exp:channel:entries entry_id="{entry_id}" disable="categories|category_fields|member_data" limit="1" channel="products"}
  <h2>{title}</h2>
  Qty Ordered: {item_qty}
  Price: {item_total}

{if Message_to_Customer}
 <div class="alert">
  {Message_to_Customer}
 </div>
{/if}
{/exp:channel:entries}
{/items}
Order Subtotal: {order_subtotal
Order Total: {order_total}
{/exp:store:orders}

The above will show the Order ID and Date, then loop through all of the order items with some additional details including the message to the customer and then it will show order details like totals.

You can see more documentation about accessing custom fields here while in the items loop. The same {items} loop is available in the cart, checkout and order tag pairs if you need to replicate that functionality on the website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.