# Email notifications

URL: https://docs.sparklayer.io/help/platforms/shopify/customisations/email-notifications
Applies to: Shopify

Customise Shopify emails for B2B customers: show B2B-only content and order details, hide discount pricing, rename payment methods and edit invites.

> **Quick summary**
>
> - B2B orders use your normal Shopify email notifications. You edit them in your Shopify admin at **Settings > Notifications** ([open in the Shopify admin](https://admin.shopify.com/settings/notifications)).
> - With small Liquid code changes, you can show content only to customers tagged `b2b`, include order details SparkLayer adds, hide discount pricing and rename payment methods.
> - The account invite email can only be customised if you use Legacy customer accounts.
> - These are code changes to Shopify templates: we can explain the approach, but we can't make the changes for you. We recommend working with a Shopify expert.

## How it works

SparkLayer orders are Shopify orders (or draft orders), so customers get Shopify's standard notification emails. Each template is Liquid code you can edit in your Shopify admin. SparkLayer adds the `b2b` tag to B2B customers and some extra details to their orders. Your templates can use these to show different content to B2B customers.

To edit a template:

1. In your Shopify admin, go to **Settings > Notifications** ([open in the Shopify admin](https://admin.shopify.com/settings/notifications)).
2. Open the template you want to change, for example **Order confirmation**, and edit its code.
3. Test your change by triggering the email (for example, by placing a real order). Test with one customer tagged `b2b` and one without.

## Show B2B-specific content in an email

To show one message to B2B customers and another to everyone else, add this code to a template and change the content as you need:

```html

  {% for tag in customer.tags %}
    {% if tag == 'b2b' %}

  	Content to show to B2B

    {% else %}

      Content to show to DTC

    {% endif %}
  {% endfor %}
```

## Show order details from Additional details

SparkLayer orders can carry extra data as order note attributes, which appear under **Additional details** on the order in Shopify. You can show these in emails, such as a delivery date or the payment method. For example, an order might have a `shipping-date` from a [custom checkout field](https://docs.sparklayer.io/help/ordering/checkout-fields.md) and a `sparkPaymentType` of `paymentOnAccount`.

Add the code to these templates:

- [Order confirmation](https://admin.shopify.com/email_templates/order_confirmation/preview)
- [Order invoice](https://admin.shopify.com/email_templates/order_invoice/preview)
- [Draft order invoice](https://admin.shopify.com/email_templates/draft_order_invoice/preview)

```html
<p>Name of field: {{ attributes.Name of Field }}</p>
<p>Name of field: {{ attributes.Another Name of Field }}</p>
```

For example, to show the shipping date and the payment method:

```html
{{ attributes.shipping-date }}
{{ attributes.sparkPaymentType }}
```

Put the code where it fits in your email layout, and adjust it to match your formatting.

To show the order note:

```html
{% if note != '' %} 
Note: {{ note }}
{% endif %}
```

## Hide discount pricing

By default, a line item in the email can show the original price struck through, the discount amount and the final price. To show B2B customers only the final price, add this CSS before the closing `</head>` tag in each of these templates:

- [Order confirmation](https://admin.shopify.com/email_templates/order_confirmation/preview)
- [Order invoice](https://admin.shopify.com/email_templates/order_invoice/preview)
- [Draft order invoice](https://admin.shopify.com/email_templates/draft_order_invoice/preview)

```css
{% for tag in customer.tags %}
    {% if tag == 'b2b' %}
    <style>
        .order-list__item-original-price,
        .order-list__item-discount-allocation,
        p.total-discount {
          display: none;
        }
    </style>
    {% else %}

    {% endif %}
  {% endfor %}
```

## Rename the payment method

The order confirmation email shows a payment method at the bottom. To change what it says for B2B payment types, add this to the **Order confirmation** template:

```html
{% assign sparkPaymentType = attributes.sparkPaymentType %}
{% if sparkPaymentType == 'paymentByInvoice' %}
 Invoice Payment [change this to the required payment name]
{% endif %}
```

## Customise the account invite email

When you add customers in Shopify yourself, what you can customise depends on the version of [customer accounts](https://admin.shopify.com/settings/customer_accounts) your store uses.

**New customer accounts.** Send customers to your store's login page (for example `yourstore.com/account`), where they enter their email and get a 6-digit access code. You can't customise that email.

**Legacy customer accounts.** When you create a new customer, send them an account invite:

1. In your Shopify admin, open the customer.
2. Click **More actions**, then **Send account invite**.

The customer gets an email with an **Activate your account** button, so they can set a password. See Shopify's guide to [inviting customers to create accounts](https://help.shopify.com/en/manual/customers/customer-accounts#invite-customers-to-create-accounts).

To change the invite email:

1. In your Shopify admin, go to **Settings > Notifications > Customer notifications** ([open in the Shopify admin](https://admin.shopify.com/settings/notifications/customer)).
2. Under **Accounts and outreach**, open **Customer account invite** and edit the [account activation email](https://admin.shopify.com/email_templates/customer_account_activate/preview).

You can make its content B2B-specific with the code in [Show B2B-specific content in an email](#show-b2b-specific-content-in-an-email). The same section has the other account emails, such as **Customer account welcome** and **Customer account password reset**.

## Next steps

- [B2B-only content](https://docs.sparklayer.io/help/platforms/shopify/customisations/b2b-only-content.md): Show content on your store only to customers tagged b2b
- [Shopify payment methods](https://docs.sparklayer.io/help/platforms/shopify/customisations/payment-methods.md): Review Pay on Account and Pay by Invoice orders and send Shopify invoices
- [Checkout fields](https://docs.sparklayer.io/help/ordering/checkout-fields.md): Collect extra details at checkout, such as a PO number or delivery date
