How do I customize order confirmation emails per product?

How do I customize order confirmation emails per product? For example, after someone orders a product, we need to send them a link to a webpage to provide additional information.

Thanks!

Customize order confirmation emails per product in Shopify, you’ll need to use Shopify’s Liquid code within the email templates.

Follow these steps

  1. Go to Settings > Notifications in your Shopify admin.
  2. Select Order confirmation.
  3. Use Liquid code to insert conditional statements based on the product ordered.
  4. Include your custom message and link within these conditional statements.

Thanks

That’s helpful, thank you! I’m not great at coding so I used ChatGPT… does this look correct to you?

The title of the product is “Estate Preparation Package” Thanks!

{% assign estate_preparation_package = false %}
{% for line_item in line_items %}
{% if line_item.title contains ‘Estate Preparation Package’ %}
{% assign estate_preparation_package = true %}
{% endif %}
{% endfor %}
{% if estate_preparation_package %}

Thank you for purchasing the Estate Preparation Package. To allow us to customize your Estate Preparation Package to your unique circumstance, please complete your onboarding form by visiting the following link: Complete Onboarding Form

{% endif %}

Hi @BuriedInWork

I believe you can use the simpler code provided below to check if any of the array items contain the string ‘Estate Preparation Package’.

{% assign has_estate_package = line_items | map: 'title' | contains: 'Estate Preparation Package' %}

If you prefer to use the code you provided earlier, you should consider adding at least one additional line of code below.

{% break %}

Thanks

Quick question:

  • What if you have more than 2 products that you’d like to create custom email confirmations for – will this still work?
  • Do you know of any developers who could help us with this?

So, @aaser018 , you meant the case when the customer ordered several products?

In my case, I’m trying to hide the single price for line items in a bundle, while showing it when the product is not part of a bundle.

{% assign has_estate_package = line_items | map: 'title' | contains: 'Estate Preparation Package' %}

Using that “simpler” way above did not work for my use case. Instead, I referred back to the first answer and that ended up working.

{% assign dont_show_bundle_price = false %}

{% if line.title contains 'BUNDLE' %}
  {% assign dont_show_bundle_price = true %}
{% endif %}

{% if line.product.title contains 'BUNDLE' %}
  {% assign dont_show_bundle_price = true %}
{% endif %}

{% if line.variant.title contains 'BUNDLE' %}
  {% assign dont_show_bundle_price = true %}
{% endif %}

{% if dont_show_bundle_price %}
  
{% else %}
  
{% endif %}

Just wanted to share in case someone runs into this issue :slightly_smiling_face:

Instead of using “title contains ‘BUNDLE’” you can probably use “tag” or “type.”

This looks good, I’d like to try it- is there a specific place in the email this code needs to go into?