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

# Showing the subscription in the order confirmation email

> A one-off tweak to the Shopify template so your customer's email states that the product is a subscription and how often it renews.

The confirmation email Shopify sends your customer after every charge looks exactly like the
one for a regular purchase: product name, quantity and price. Nothing indicates that the
order is part of a subscription, or how often it will repeat.

With a one-off tweak to the template —two minutes, once per store— the email starts showing
the frequency underneath each product.

<Note>
  **The data is already on the order.** Reval tags every line of the orders it generates with
  a property stating the frequency. You can see it right now by opening any subscription
  order in your Shopify admin. All that's missing is for the email template to print it,
  because Shopify's default template doesn't display line properties.
</Note>

<Warning>
  **The labels are emitted in Spanish** (`Suscripción`, `Compra única`, `Mensual`…). Reval
  writes these strings into the order's line properties, so they're what your customer sees
  in the email regardless of your admin's language. Keep them verbatim in the template — they
  aren't translated by Reval today.
</Warning>

## What your customer will see

Underneath each product name, in grey and in a small size:

| Product's plan | Appears in the email        |
| -------------- | --------------------------- |
| Every 1 month  | `Suscripción: Mensual`      |
| Every 3 months | `Suscripción: Cada 3 meses` |
| Every 1 week   | `Suscripción: Semanal`      |
| Every 15 days  | `Suscripción: Cada 15 días` |

If the customer also bought a one-time add-on, that line stands out on its own:

```
Compra única: Pago único — abonado por separado
```

That avoids the most common misunderstanding with add-ons: the customer believing that the
extra product will also be charged every month.

## How to do it

<Warning>
  You need admin access to the store. Shopify doesn't expose an API for notification
  templates —they can only be edited by hand— so Reval can't make this change for you at
  install time.
</Warning>

<Note>
  The menu names are given here in English and Spanish because they depend on the language
  your Shopify admin is set to.
</Note>

<Steps>
  <Step title="Go to customer notifications">
    In your Shopify admin: **Settings → Notifications** *(Configuración → Notificaciones)*.

    Inside, choose **Customer notifications** *(Notificaciones a clientes)*. It's the first in
    the list, the one that says "Notify customers about order and account events".
  </Step>

  <Step title="Open the order confirmation">
    In the **Order processing** group, the first row: **Order confirmation** *(Confirmación de
    pedido)*, described as "Sent when a customer places an order".
  </Step>

  <Step title="Open the code editor">
    Top right, the **Edit code** *(Editar código)* button. It sits next to **Send test**
    *(Enviar prueba)*.
  </Step>

  <Step title="Find the variant block — there is MORE THAN ONE">
    The email body is hundreds of lines, so don't hunt for it by eye. Click **inside the code
    editor** and only then use `Ctrl+F` / `Cmd+F`: the browser's find doesn't work, because
    the editor only keeps the visible part of the file loaded. Search for:

    ```
    and is_parent == false
    ```

    <Warning>
      **Shopify prints the product list more than once, and you have to paste the snippet in
      two places.** The template forks at
      `{% if delivery_method_types.size > 1 %}`: one branch for orders with more than one
      delivery method and another (`{% else %}`) for the rest — which are the vast majority.
      If you only paste into the first one, normal orders keep going out without the frequency
      and it looks like the change didn't work.
    </Warning>

    In the default template you'll find four matches. The ones you want are **the two that use
    `line.variant.title`** and sit inside a `{% for line in subtotal_line_items %}`: one in
    each branch of the `if`. You can ignore the other two:

    | Match                                                                               | What it is                                                              | Paste?                               |
    | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------ |
    | `line.variant.title`, inside `for line in subtotal_line_items`                      | The product list, multiple-delivery-methods branch                      | **Yes**                              |
    | `line.variant.title`, inside the second `for line in subtotal_line_items`           | The same list, `{% else %}` branch — **the one used by a normal order** | **Yes**                              |
    | `line.variant.title`, inside `for line in delivery_agreement.non_parent_line_items` | Deliveries with a scheduled day and time                                | Only if you use scheduled delivery   |
    | `component.variant.title`, inside `for component in line_item_group.components`     | Bundle components                                                       | No — the variable there isn't `line` |
  </Step>

  <Step title="Paste the snippet at BOTH main matches">
    In each one, the exact spot is **after the `{% endif %}` that closes the variant block**.
    You'll know you're in the right place because the next line starts with `{% if false %}`.

    Here's what the area looks like, with the snippet already in place (identical in both
    spots):

    ```liquid theme={null}
    <span class="order-list__item-title">{{ line_title }}&nbsp;&times;&nbsp;{{ line_display }}</span><br/>

    {% if line.variant.title != 'Default Title' and is_parent == false %}
      <span class="order-list__item-variant">{{ line.variant.title }}</span><br/>
    {% elsif line.variant.title != 'Default Title' and line.nested_line_parent? %}
      <span class="order-list__item-variant">{{ line.variant.title }}</span><br/>
    {% elsif line.variant.title != 'Default Title' and line.bundle_parent? and false == false %}
      <span class="order-list__item-variant">{{ line.variant.title }}</span><br/>
    {% endif %}

    {% comment %} Reval — muestra la frecuencia de la suscripción {% endcomment %}
    {% for property in line.properties %}
      {% unless property.last == blank %}
        <span style="font-size:13px;color:#777;">{{ property.first }}: {{ property.last }}</span><br/>
      {% endunless %}
    {% endfor %}

    {% if false %}
    ```

    The first four lines and the last one are already in your template: they're there to
    confirm you pasted in the right place. What you add is only the block that starts with
    `{% comment %} Reval`.

    <Note>
      Before saving, check that `{% comment %} Reval` appears **twice** in the template. If it
      appears only once, you missed the second branch — and that's precisely the one normal
      orders use.
    </Note>
  </Step>

  <Step title="Save and verify">
    Save the changes.

    The **Send test** *(Enviar prueba)* button uses sample data with no line properties, so it
    **won't show you the frequency**. It's no use for verifying this change.

    First confirm the data exists: open a subscription order under **Orders** —filter them by
    the `Suscripción` tag— and check that `Suscripción: Mensual` appears underneath the
    product. If it isn't there, the problem isn't the template and you won't solve it by
    editing it.

    Having it on the order record is **necessary but not sufficient**: the email will still go
    out without the frequency if the snippet only ended up in one branch. The only real check
    is to look at the email for an order with a single shipping method, which is the case that
    uses the `{% else %}` branch.

    <Warning>
      If you want to see the real email, you can resend it from the order with **••• → Resend
      order confirmation**. But that **sends a genuine email to that order's customer**. Don't
      do it on a real purchase: someone would receive a duplicate confirmation for an old
      order. Use a test order of your own.
    </Warning>
  </Step>
</Steps>

<Tip>
  The `{% comment %} Reval … {% endcomment %}` comment doesn't show in the email. It's there
  so that six months from now someone understands why that block is there before deleting it.
</Tip>

## Before you call it done

**It's done once per store, and it survives Reval updates** — the template is yours, it lives
in Shopify, and we don't touch it when we update the app.

**If you switch themes, check that it's still there.** Notification templates are independent
of the theme, so they normally aren't lost. But if at some point you restore the default
template via **Revert to default template**, the snippet goes with it and has to be pasted
again.

**If you have other apps that add properties to lines** —custom engravings, gift messages,
delivery dates— this snippet will print those too, because it walks through every property on
the line. Generally that's what you want. If you'd rather show only the subscription one,
replace the `{% unless property.last == blank %}` condition with
`{% if property.first == 'Suscripción' or property.first == 'Compra única' %}` and close with
`{% endif %}` instead of `{% endunless %}`.
