If you're looking to add some information about the digital attachment and its files to your order confirmation email or to the SMS that Shopify sends to your customers, then this is what you're looking for!
This is an advanced feature that requires some knowledge of the use of the Shopify liquid programming language. If you're unsure how to do this, please reach out to us, and we'd be happy to help you.
When you create an attachment in the app, the app will automatically create some metafields on the product variant that you can access within the liquid templates of the order confirmation notification. The namespace on the metafields is "kable" and the main object variable is "attachment". The list of variables within this attachment are:
- {{ variant.metafields.kable.attachment.name }} - the label you gave the attachment in the app
- {{ variant.metafields.kable.attachment.tags }} - internal tags for the attachment, comma separated.
- {{ variant.metafields.kable.attachment.download_limit }} - the max number of downloads allowed fo an attachment that you may (or not) have set, if you didn't set it then it will be ignored.
- {{ variant.metafields.kable.attachment.download_duration_limit }} - the length of time an attachment can be downloaded by a customer after purchase that you may (or not) have set, if you didn't set it then it will be ignored.
- {{ variant.metafields.kable.attachment.enabled }} - whether or not the attachment is enabled within the app.
- {{ variant.metafields.kable.attachment.product_name }} - name of the product the attachment is linked to.
- {{ variant.metafields.kable.attachment.variant_name }} - name of the variant the attachment is linked to.
- {{ variant.metafields.kable.attachment.description }} - the description you configured on the attachment in the app.
- {{ variant.metafields.kable.attachment.description }} - the first image from the product the attachment is linked to.
- {{ variant.metafields.kable.attachment.file_count }} - the number of files uploaded for this attachment.
- {{ variant.metafields.kable.attachment.files }} - the list of file objects that you've uploaded to this attachment.
Then, for each file that has been uploaded for the attachment, the available variables are:
- {{ file.label_label }} - the label of the file that you configured in the app.
- {{ file.download_filename }} - the filename used when the customer downloads the file that you configured in the app.
- {{ file.content_type }} - the type of the file (for example, application/pdf).
- {{ file.file_size }} - the size of the file in bytes.
- {{ file.download_url }} - URL template to directly download the file. To use this you must replace "||order_token||" with the {{ token }} variable in your order confirmation email. Use the liquid statement {{ file.download_url | replace: "||order_token||", token }}
- {{ file.download_page_url }} - URL template to download the file deeplink on the download page. To use this you must replace "||order_token||" with the {{ token }} variable in your order confirmation email. Use the liquid statement {{ file.download_url | replace: "||order_token||", token }}
These variant metafields will, in fact, work with any of the Shopify notification templates or within the themes in a similar way.
That's it! Feel free to contact us if you have any questions.
Update Aug. 24, 2020: Shopify no longer passes the "token" liquid variable through to the notification templates. Use the following to get the order token:
{% assign order_status_url_parts = order_status_url | split: '/' %}
{% assign token = order_status_url_parts[5] %}