Skip to main content

Add invoice download link (URL) to the Shopify admin emails

Copy and paste the snippet, takes only a few minutes

Add a Fakturownia document download link (URL) to your Shopify notification emails, for example when an order is created or paid. Your customer clicks it and the order’s document opens in Fakturownia.

Add the link to your Shopify emails

Four steps, about 2 minutes.

<!-- Fakturownia document URL Code START -->
{% assign secret_key = shop.metafields.app--96456540161--hmac.secret_key %}
{% assign data_to_sign = order.id | append: shop.id %}
{% assign hmac = data_to_sign | hmac_sha256: secret_key %}
<p>
You can download your document <a href="https://make-it-easy-fakturownia.gadget.app/order-document-link?orderId={{ order.id }}&shopId={{ shop.id }}&hmacVerification={{ hmac }}">here</a>.
</p>
<!-- Fakturownia document URL Code END -->

Step 2: Open Shopify Settings » Notifications » Customer Notifications

Step 3: Choose the notification (email) » Click Edit code

For example, the Order Confirmation email. Any other notification works too.

Step 4: Paste the snippet and Save

Paste the snippet into the email body where you want the link. Use Preview to check where it shows up, then click Save.

You can edit the “You can download your document here” text in the snippet to translate or change it.

Which document the link opens

Your customers can now download the document straight from the email.

  • The link opens the order’s invoice. If there isn’t one, it opens the proforma, receipt, prepayment invoice, bill or final invoice, in this order (the latest of that type).

  • The link doesn’t expire.

  • If the order has no document yet, the link shows an error (No valid document ID found).

  • If the link gives a 401 Unauthorized error right after setup, Shopify is still caching the email. Try again in 3 hours.

Did this answer your question?