Lead time in order emails
Weft saves the lead time on every order: as a line item property ("Lead time: 6–8 weeks") and, if turned on, as the cart attribute "Longest lead time". Shopify's default order confirmation email doesn't print either. This page gives you a snippet that adds them.
The snippet is supported: if it doesn't work as described here, contact support. Other changes to your email templates aren't covered. For those, we recommend hiring a Shopify Partner.
Before you start #
- Check Theme settings > Lead times > Save lead time on the order. The snippet reads Visible at checkout (Lead time) and Admin only (_lead_time). With Don't save, there's nothing to print.
- For the order-level line, turn on Save the longest lead time on the order.
- Notification templates aren't part of the theme, so duplicating the theme doesn't back them up. Copy the template's code into a text file before you edit it. If something goes wrong, you can paste it back, or use Revert to default in the template editor.
Step 1: add the lead time to each item #
- In your admin, go to Settings > Notifications.
- Click Customer notifications, then Order confirmation.
- Click Edit code.
- Select all the code and copy it to a text file as a backup.
- Search the code (Ctrl+F or Cmd+F) for
order-list__item-variant. The first match is inside the loop that prints each item,{% for line in subtotal_line_items %}. - A few lines below that match is an
{% endif %}. Put your cursor after it, press Enter and paste this:
{%- comment -%} Weft: lead time saved on this item {%- endcomment -%}
{%- for property in line.properties -%}
{%- if property.first == 'Lead time' or property.first == '_lead_time' -%}
{%- unless property.last == blank -%}
<span class="order-list__item-variant">Lead time: {{ property.last }}</span><br/>
{%- endunless -%}
{%- endif -%}
{%- endfor -%}If your template looks different, paste the snippet anywhere between {% for line in subtotal_line_items %} and its {% endfor %}, inside the table cell that holds the product title. Outside that loop, line doesn't exist and nothing prints.
Step 2: add the longest lead time to the order #
- In the same template, search for
Order summary. In Shopify's default template it's a heading:<h3>Order summary</h3>. - Paste this on a new line directly below that heading:
{%- comment -%} Weft: longest lead time of the order {%- endcomment -%}
{%- for attribute in attributes -%}
{%- if attribute.first == 'Longest lead time' and attribute.last != blank -%}
<p>Your order ships together when the last piece is ready. Longest lead time: <strong>{{ attribute.last }}</strong>.</p>
{%- endif -%}
{%- endfor -%}- Click Save.
Step 3: test it #
The editor's preview uses sample data that has no lead time, so it won't show the new lines. Place a real test order instead:
- Turn on test mode for your payment provider, or use Shopify's Bogus Gateway on a development store.
- Add a product to the cart on your storefront and check out with your own email address.
- Open the confirmation email. Each item should show "Lead time: 6–8 weeks", and the summary should show the longest lead time.
- Cancel or delete the test order.
Change the wording #
- Change "Lead time:" in step 1 or the sentence in step 2 to anything you like. The text is plain HTML.
- If your store sells in several languages, add the translation inside the snippet with your own
{% if %}checks, or keep the wording short. - The property name itself comes from the theme's language file. If you edited "Lead time" in Online Store > Themes > ... > Edit default theme content, use the same name in the snippet.
Other emails #
The snippet is written for the order confirmation. Other notification templates, such as the shipping confirmation, loop over items in a different way, so the snippet would need changes there. Adapting it is outside theme support.