BTP Integration in Shopify Email Template
OVERVIEW:
The following document provides a brief description of replacing, adding URLs anywhere in email notification templates. The document is using examples of email notifications taken from Shopify. Email notifications covered below are :
Shipping Confirmation
Shipping Update
Out of Delivery
Delivered
GOALS:
Altering or replacing Shopify order Status URL to Fenix Branded tracking page URL.
Altering or replacing multiple tracking number’s URLs to Fenix Branded tracking page URL.
REQUIREMENTS :
Fenix Provided Branded Tracking page URL for your store.
Tracking number of any successful order.
SPECIFICATIONS :
Tracking page URLs works only for the US region/country.
So the provided code snippets and Fenix Branded only work for US-based tracking numbers.
API DOCS:
Fenix Branded Tracking page URLs works with the following request parameters.
e.g. Branded Tracking Page url is :
https://tracking.fenixcommerce.com/mystore/tracking/mystore
Request parameters as below :
Request Parameter | Value ( Sample Values ) |
tracking_numbers | 1Z5F44813600X02768 |
shop.name | https://yourstore.myshopify.com |
tracking_company | UPS |
shipping_address | Shipping Company Steve Shipper123 Shipping Street Shippington, KY 40003 United States |
In Which tracking_numbers is the required parameter
2. Final tracking URL would be as below :
https://tracking.fenixcommerce.com/mystore/tracking/mystore?tracking_numbers=1Z5F44813600X02768&shop.name=https://mystore.shopify.com&tracking_company=UPS&shipping_address=Shipping CompanySteve Shipper123 Shipping StreetShippington, KY40003UnitedStates¬ification_identity_id=U0hJUE1FTlQgTk9USUZJQ0FUSU9OfEVNQUlMfEZFTklYfEFXUyBTRVM=
SAMPLE Notification Template Edit Step By Step :
Login to Shopify store
Visit Settings and Notification settings. /admin/settings/notifications
Edit template Shipping confirmation
4. Code snippet for above sample preview Looks like below.
Existing sample code from Email templates as below
<a href="{{ order_status_url }}" class="button__text">View your order</a>
5. Final code snippet you should be able to replace as below.
Change to below code
{% if shipping_address.country == "United States" %}
{% if fulfillment.tracking_numbers.size > 0 %}
<a href='{% if fulfillment.tracking_numbers.size == 1 and fulfillment.tracking_company and fulfillment.tracking_url %}
https://tracking.fenixcommerce.com/mystore/tracking/mystore?tracking_numbers={{fulfillment.tracking_numbers.first}}&shop.name={{shop.url}}&tracking_company={{fulfillment.tracking_company}}&shipping_address={% if shipping_address and shipping_address != "" and shipping_address != nil %}{% if shipping_address.company != blank %}{{ shipping_address.company }}{% endif %}{{ shipping_address.name }}{{ shipping_address.address1 }}{% if shipping_address.address2 != blank %}{{shipping_address.address2 }}{% endif %}{{ shipping_address.city }}, {% if shipping_address.province_code != blank and shipping_address.country_code != "JP" %}{{ shipping_address.province_code }}{% else %}{{ shipping_address.province }}{% endif %}{{ shipping_address.zip | upcase }}{{ shipping_address.country }}{% endif %}¬ification_identity_id=U0hJUE1FTlQgTk9USUZJQ0FUSU9OfEVNQUlMfEZFTklYfEFXUyBTRVM=' class="button__text">View your order</a>
{% elsif fulfillment.tracking_numbers.size == 1 %}
<a href='https://tracking.fenixcommerce.com/mystore/tracking/mystore?tracking_numbers={{fulfillment.tracking_numbers.first}}&shop.name={{shop.url}}&shipping_address={% if shipping_address and shipping_address != "" and shipping_address != nil %}{% if shipping_address.company != blank %}{{ shipping_address.company }}{% endif %}{{ shipping_address.name }}{{ shipping_address.address1 }}{% if shipping_address.address2 != blank %}{{shipping_address.address2 }}{% endif %}{{ shipping_address.city }}, {% if shipping_address.province_code != blank and shipping_address.country_code != "JP" %}{{ shipping_address.province_code }}{% else %}{{ shipping_address.province }}{% endif %}{{ shipping_address.zip | upcase }}{{ shipping_address.country }}{% endif %}¬ification_identity_id=U0hJUE1FTlQgTk9USUZJQ0FUSU9OfEVNQUlMfEZFTklYfEFXUyBTRVM=' class="button__text">Track my shipment</a>
{% else %}
{% for tracking_number in fulfillment.tracking_numbers %}
<a href='https://tracking.fenixcommerce.com/mystore/tracking/mystore?tracking_numbers={{ tracking_number }}&shop.name={{shop.url}}&shipping_address={% if shipping_address and shipping_address != "" and shipping_address != nil %}{% if shipping_address.company != blank %}{{ shipping_address.company }}{% endif %}{{ shipping_address.name }}{{ shipping_address.address1 }}{% if shipping_address.address2 != blank %}{{shipping_address.address2 }}{% endif %}{{ shipping_address.city }}, {% if shipping_address.province_code != blank and shipping_address.country_code != "JP" %}{{ shipping_address.province_code }}{% else %}{{ shipping_address.province }}{% endif %}{{ shipping_address.zip | upcase }}{{ shipping_address.country }}{% endif %}¬ification_identity_id=U0hJUE1FTlQgTk9USUZJQ0FUSU9OfEVNQUlMfEZFTklYfEFXUyBTRVM=' class="button__text">Track my shipment</a>
{% endfor %}
{% endif %}
{% endif %}
{% else %}
<a href="{{ order_status_url }}" class="button__text">View your order</a>
{% endif %}
Â
Following snippets can be compared with your final notification email templates, which are pre-integrated Fenix Branded Tracking Page URL ( https://tracking.fenixcommerce.com/mystore/tracking/mystore )
https://tracking.fenixcommerce.com/mystore/tracking/mystore This URL needs to be replaced with Fenix Team provided Branded tracking page URL
Â