Add the Cancellation Management Code to Shopify's Order Confirmation Emails

Follow

If you choose to use the Cancellation Management in Bold Subscriptions feature and cancellation discount codes, there is a snippet of code you should insert into the "Order confirmation" email Shopify sends out to your customers. 

This snippet of code will stack two coupon codes on top of each other, please follow these instructions to insert it:

  1. From Shopify's admin, select Settings.

    select settings

  2. Select Notifications.

    select notifications

  3. Select Order confirmation.

    select order confirmation

  4. Find this section of code:
    <table class="row subtotal-lines">
    <tr>
    <td class="subtotal-spacer"></td>
    <td>
    <table class="row subtotal-table">
    {% for discount_application in discount_applications %}
    {% if discount_application.target_selection == 'all' %}
    {% capture discount_title %}
    {% if discount_application.title %}
    {{ discount_application.title | upcase }}
    {% else %}
    Discount
    {% endif %}
    {% endcapture %}

    Find row subtotal-lines Code Block

  5. Copy and paste the following snippet of code right above this line: {% if discount_application.target_selection == 'all' %}
    {% if attributes.cancellation-coupon-code == discount_application.title %}
    {% continue %}
    {% endif %}

    Paste Code above discount_application.target_selection

  6. Find this section of code:
    <td class="subtotal-line__value">
    <strong>-{{ discount_application.total_allocated_amount | money }}</strong>
    </td>
    </tr>

    {% endif %}
    {% endfor %}

    Find subtotal-line__value Code Block

  7. Copy and paste the following snippet of code right below this line: {% endfor %}
    {% if attributes.cancellation-coupon-code %}
    {% if attributes.cancellation-coupon-unformatted-amount %}
    {% assign cancellation_discount_amount = attributes.cancellation-coupon-unformatted-amount | times: 100.00 | minus: 0.00 | money %}
    {% endif %}
    <tr class="subtotal-line">
     <td class="subtotal-line__title">
     <p>
     <span>Cancellation Discount</span>
     <span class="subtotal-line__discount">
     <img src="{{ 'notifications/discounttag.png' | shopify_asset_url }}" width="18" height="18" class="discount-tag-icon" />
     <span class="subtotal-line__discount-title">{{ attributes.cancellation-coupon-code }}</span>
     </span>
     </p>
     </td>
     <td class="subtotal-line__value">
     <strong>{% unless attributes.cancellation-coupon-amount == 'Free Shipping' %}-{% endunless %}{{ cancellation_discount_amount | default: attributes.cancellation-coupon-amount }}</strong>
     </td>
    </tr>
    {% endif %}
    {% assign cancellation_discounted_amount = attributes.cancellation-coupon-unformatted-amount | default: 0.00 | times: 100.0 | minus: 0.00 %}

    Paste Code below endfor

  8. Find this section of code:
    <tr class="subtotal-line">
     <td class="subtotal-line__title">
    <p>
    <span>Subtotal</span>
     </p>
     </td>
     <td class="subtotal-line__value">
     <strong>{{ subtotal_price | money }}</strong>
     </td>
    </tr>

    Find subtotal-line Code Block

  9. Copy and paste the following snippet of code overtop of this line: <strong>{{ subtotal_price | money }}</strong>
    <strong>
    {% if attributes.cancellation-coupon-is-cashier %}{{ subtotal_price | money }}
    {% else %}{{ subtotal_price | minus: cancellation_discounted_amount | money }}
    {% endif %}
    </strong>

    Paset Code over subtotal_price | money Line

  10. Find this section of code:
    <tr class="subtotal-line">
     <td class="subtotal-line__title">
     <p>
     <span>Total</span>
     </p>
     </td>
    <td class="subtotal-line__value">
     <strong{{ total_price | money_with_currency }}</strong>
     </td>
    </tr>

    Find subtotal-line__title Code Block

  11. Copy and paste the following snippet of code overtop of this line: <strong>{{ total_price | money_with_currency }}</strong>
    <strong>
    {% if attributes.cancellation-coupon-is-cashier %}{{ total_price | money_with_currency }}
    {% else %}{{ total_price | minus: cancellation_discounted_amount | money_with_currency }}
    {% endif %}
    </strong>

    Paste Code over total_price | money_with_currency Line

  12. Find this section of code:
    {% if total_discounts > 0 %}
    <p class="total-discount">
    You saved <span class="total-discount--amount">{{ total_discounts | money }}</span>
    </p>
    {% endif %}

    Find total-discount Code Block

  13. Copy and paste the following snippet of code overtop of this line: You saved <span class="total-discount--amount">{{ total_discounts | money }}</span>
    You saved <span class="total-discount--amount">{% if attributes.cancellation-coupon-is-cashier %}{{ total_discounts | money }}
    {% else %}{{ total_discounts | plus: cancellation_discounted_amount | money }}
    {% endif %}
    </span>

    Paste Code over You Saved Line

  14. Select Save.

    select save

That's it!

Helpful Links:

Next Steps:

Blog Posts:

2 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.