> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supercycle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Shopify notifications

> Customize Shopify's order and customer emails for rentals, subscriptions, and charges.

## Overview

Shopify sends its own set of transactional emails — order confirmation, shipping updates, refund notifications, and more — directly from your store. These are separate from [Supercycle notifications](/supercycle-notifications), which cover rental-, return-, and subscription-specific events.

Because Supercycle products are sold through Shopify checkout, many customer-facing communications (and your own staff notifications) are still triggered by Shopify. To make these emails work well for rental, membership, and subscription orders, you can extend Shopify's notification templates with small Liquid snippets that read Supercycle data from the order and line items.

Common reasons to customize these templates:

* Show rental **start** and **end dates** in order confirmations and staff notifications.
* Display different messaging for **subscription** orders versus one-off purchases.
* Tell customers about a **charge** (for example, a late fee or damage charge) created in Supercycle.
* Link customers to their **account portal** so they can manage a subscription.

## Walkthrough

You don't need to be a developer to add these snippets — most templates only need a small edit in Shopify's notification editor.

<Steps>
  <Step title="Open Notifications in Shopify">
    From your Shopify admin, go to **Settings** then **Notifications**.
  </Step>

  <Step title="Choose a notification template">
    Find the notification template you want to edit (for example, **Order confirmation**, **New order**, or **Order edited**) and click to open it.
  </Step>

  <Step title="Add the snippet">
    Copy the snippet you need from the sections below and paste it into the relevant part of the subject line or email body.
  </Step>

  <Step title="Preview and save">
    Use Shopify's **Preview** to check how the email renders, then **Save**.
  </Step>

  <Step title="Send a test">
    From the same screen, send a test email to yourself to confirm the content looks right with real order data.
  </Step>
</Steps>

<Note>
  Order tags are applied to an order after it is created, which means they are not available when the email template is rendered. Don't use tags to branch notification emails — use line item properties instead.
</Note>

## Snippets

### Order has a subscription

Use to display different content if a line item has a subscription. This matches any order with a subscription — including recurring ones — so keep the message neutral, or combine it with the recurring check below. It can be used to show a link to your customer accounts, where the customer can manage their subscription.

```liquid theme={null}
{% assign has_subscription = false %}
{% for line_item in line_items %}
  {% if line_item.selling_plan_allocation %}
    {% assign has_subscription = true %}
    {% break %}
  {% endif %}
{% endfor %}

{% if has_subscription %}
  <p>This order contains a subscription. <a href="{{ shop.url }}/account">Manage your subscription</a></p>
{% else %}
  <p>Thank you for your order</p>
{% endif %}
```

### Order vs recurring subscription Order

Use to display different content if it's a recurring order. Recurring orders created by Supercycle include a `rental_id` line item property — the original checkout order doesn't.

```liquid Email body theme={null}
{% assign is_recurring = false %}
{% for line_item in line_items %}
  {% for prop in line_item.properties %}
    {% if prop.first == 'rental_id' %}
      {% assign is_recurring = true %}
    {% endif %}
  {% endfor %}
{% endfor %}

{% if is_recurring %}
  <p>Thank you for your subscription order</p>
{% else %}
  <p>Thank you for your order</p>
{% endif %}
```

To change the email subject too, paste this whole snippet — including the detection loop — into the **Email subject** field. It's the same check, written with `{%-` whitespace control so the subject renders as a single line:

```liquid Email subject theme={null}
{%- assign is_recurring = false -%}
{%- for line_item in line_items -%}
  {%- for prop in line_item.properties -%}
    {%- if prop.first == 'rental_id' -%}{%- assign is_recurring = true -%}{%- endif -%}
  {%- endfor -%}
{%- endfor -%}
{%- if is_recurring -%}
  Thanks for your subscription order, {{ customer.first_name }}
{%- else -%}
  Thanks for your order, {{ customer.first_name }}
{%- endif -%}
```

<Warning>
  Don't use `order.source_name == 'subscription_contract'` to detect recurring orders. Shopify changed `source_name` values without notice, and initial checkout orders can now match this condition too.
</Warning>

### Show start and end dates

Use to show the start and end dates of the line items. This example code works best when all the products have fixed dates enabled.

```liquid theme={null}
{% assign start_date = '' %}
{% assign end_date = '' %}

{% for line_item in order.line_items %}
  {% for prop in line_item.properties %}
    {% if prop.first == 'Start date' %}
      {% assign start_date = prop.last %}
    {% elsif prop.first == 'End date' %}
      {% assign end_date = prop.last %}
    {% endif %}
  {% endfor %}
{% endfor %}

{% if start_date != '' %}
  <p><strong>Start date:</strong> {{ start_date }}</p>
{% endif %}
{% if end_date != '' %}
  <p><strong>End date:</strong> {{ end_date }}</p>
{% endif %}
```

You can incorporate this into Shopify's default notifications to display the dates in the product list if your template isn't outputting the line item properties.

#### Adding rental dates to staff notifications

To display rental start and end dates in staff notifications (like "New order" notifications), add this code within the line item loop in your notification template:

```liquid theme={null}
{%- assign rental_start_date = '' -%}
{%- assign rental_end_date = '' -%}
{%- for prop in line.properties -%}
  {%- if prop.first == 'Start date' -%}
    {%- assign rental_start_date = prop.last -%}
  {%- elsif prop.first == 'End date' -%}
    {%- assign rental_end_date = prop.last -%}
  {%- endif -%}
{%- endfor -%}
{%- if rental_start_date != '' or rental_end_date != '' -%}
  <p class="order-list__item-variant" style="margin-top: 4px;">
    <strong>Rental details</strong><br>
    {%- if rental_start_date != '' -%}
      Start date: {{ rental_start_date }}<br>
    {%- endif -%}
    {%- if rental_end_date != '' -%}
      End date: {{ rental_end_date }}
    {%- endif -%}
  </p>
{%- endif -%}
```

This code should be placed inside the line item loop (where `line` represents each line item) to display rental dates for each product in the order.

### Check if the order has a charge

Use to show different content if the order notification is a normal order or for a charge created in Supercycle.

```liquid theme={null}
{% assign has_charge = false %}
{% assign charge_reason = '' %}

{% for line_item in order.line_items %}
  {% for prop in line_item.properties %}
    {% if prop.first == 'Charge' %}
      {% assign has_charge = true %}
      {% assign charge_reason = prop.last %}
    {% endif %}
  {% endfor %}
{% endfor %}

{% if has_charge %}
  <p>You have been charged: {{ charge_reason }} </p>
{% else %}
  <p>Thank you for your order</p>
{% endif %}
```
