Draft order invoice Template

When using Giftship’s multiple shipping address tool to create orders in the Shopify admin, edits should to be made to your Draft Order Invoice email template to account for this alternate shipping method. There are two options for configuration.

Note: We recommend backing up your existing email template before making the below changes

Option 1

The simplest way to configure your Order Confirmation system is to follow these steps:

> Copy and paste our pre-made template.

*** WARNING ***

By following the instructions below, you will overwrite any customizations you have made to your Draft Order Invoice template. If you have customized your template, you will need to incorporate your customizations into the below. We cannot support any third party customizations that are needed.

  1. Copy / paste the pre-built order confirmation email template code at the below url:
    https://github.com/GistApps/giftship-email-template/blob/main/draft-order-invoice.liquid
  2. Go to Settings -> Notifications -> Draft order invoice, and replace the contents of the order confirmation template.
  3. Click Save

Option 2

Adjust your pre-existing Draft Order Invoice template with manual edits.

To start go to Settings –> Notifications –> Draft order invoice and begin editing the template.

Step 1: Add the multi-address identifier

At the very top of your file, insert the following code before everything else.

{% comment %}
START: Giftship multi-address order check
{% endcomment %}
{%-liquid
  assign ms_order = false 
  for tag in order.tags
    if tag == "ms_order"
      assign ms_order = true
    endif
  endfor
-%}
{% comment %}
END: Giftship multi-address order check
{% endcomment %}
Step 2: Hide placeholder items and set up image overrides
  1. Search for: {% for line in subtotal_line_items %}
  2. Directly below that line, paste the following snippet:
{% comment %} START: Giftship routing logic {% endcomment %}
{% if ms_order %}
  {% if line.variant.title == "Tax" or line.title == "Tax" %}{% assign tax_price = line.final_line_price %}{% continue %}{% endif %}
  {% if line.variant.title == "Shipping" or line.title == "Shipping" %}{% assign shipping_price = line.final_line_price %}{% continue %}{% endif %}
  {% assign overridden_image = line.properties._gs_image | default: false %}
  {% assign overridden_title = line.properties._gs_title | default: false %}
{% else %}
  {% assign overridden_image = false %}
  {% assign overridden_title = false %}
{% endif %}
{% comment %} END: Giftship routing logic {% endcomment %}
Step 3: Update the product images
  1. Search the file for: {{ line | img_url: 'compact_cropped' }}
  2. You should find two instances of this exact snippet relatively close to each other.
  3. Replace both instances with this snippet:
{% if overridden_image %}{{ overridden_image }}{% else %}{{ line | img_url: 'compact_cropped' }}{% endif %}
Step 4: Display clean titles and shipping addresses
  1. Search the file for this exact line of code: <span class="order-list__item-title">{{ line_title }}&nbsp;&times;&nbsp;{{ line_display }}</span><br/>
  2. Replace that single line with this code block:
{% comment %} START: Giftship Title and Address {% endcomment %}
{% if overridden_title %}{% assign line_title = overridden_title %}{% endif %}
<span class="order-list__item-title">{{ line_title }}&nbsp;&times;&nbsp;{{ line_display }}</span><br/>
{% for p in line.properties %}
  {% unless p.first.first == "_" %}
    <span>{{ p.first }}</span>: <span>{{ p.last }}</span><br/>
  {% endunless %}
{% endfor %}
{% comment %} END: Giftship Title and Address {% endcomment %}
Step 5: Hide routing variants
  1. Search the file for this line: {% if line.variant.title != 'Default Title' and is_parent == false %}
  2. Add {% unless ms_order %} directly above it.
  3. Look a few lines down for the {% endif %} that closes that block (it is right before the {% if true %} block for bundle components). Add {% endunless %} directly below it.

When finished, that section should look exactly like this:

{% comment %} START: Giftship Variant Hide {% endcomment %}
{% unless ms_order %}
{% 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 true == false %}
  <span class="order-list__item-variant">{{ line.variant.title }}</span><br/>
{% endif %}
{% endunless %}
{% comment %} END: Giftship Variant Hide {% endcomment %}
Step 6: Correct the Subtotal Calculation
  1. Search the file for this line: <tr class="subtotal-line">
  2. Replace the entire tr block with the following code:
{% comment %} START: Giftship Subtotal Correction {% endcomment %}
{% assign corrected_subtotal_price = subtotal_price %}
{% if ms_order %}
  {% assign gs_tax = tax_price | default: 0 %}
  {% assign gs_shipping = shipping_price | default: 0 %}
  {% assign corrected_subtotal_price = subtotal_price | minus: gs_tax | minus: gs_shipping %}
{% endif %}

<tr class="subtotal-line">
  <td class="subtotal-line__title">
    <p>
      <span>Subtotal</span>
    </p>
  </td>
  <td class="subtotal-line__value">
      <strong>{{ corrected_subtotal_price | plus: subtotal_order_amount | money }}</strong>
  </td>
</tr>
{% comment %} END: Giftship Subtotal Correction {% endcomment %}

Click Save.

Can't find the answer in our documentation?
Contact Support