Hi there
We’re trying to attach a pdf to our invoices only if a customer buys a certain product.
Is this possible within Shopify or does anyone know a way how to achieve this perhaps with an App?
Thanks,
Evert
Hi there
We’re trying to attach a pdf to our invoices only if a customer buys a certain product.
Is this possible within Shopify or does anyone know a way how to achieve this perhaps with an App?
Thanks,
Evert
Hi @greiseve ,
I understand that you’re trying to attach a PDF to your invoices only if a customers buys a certain product.
This is possible within Shopify by writing custom code for your Draft order invoice email notification template. The code would look for a particular product within the order and, if found, include the PDF link.
This solution works best if you’re targeting one or a limited selection of products. However, if you have a lot of products needing unique PDF links, it’s probably a better idea to look for an app to solve this.
Are you targeting one or multiple products? Does every product being targeted have the same PDF link?
If you’re willing to describe your use case for this in detail, the community can point you in the right direction.
Cheers!
Brian
Thanks for the help. Much appreciated.
We have one product category that only requires one pdf link.
I would assume that it’s a if/then (category match) the pdf link is inserted.
Is this fairly easily executed in the script?
Thanks,
Evert
@greiseve Yes, it’s a fairly simple line of code like an if/then.
When you say one product category, and matching for that category – how are you doing the matching or defining the category? By collection, tag, vendor?
@BrianAtWork we would use our ‘collections’ as an identifier. So if something matches collection X then we want to display the pdf link.
@greiseve Okay, try this out in your invoice notification template:
Notes:
{% assign show_PDF_link = false %}
{% for line in subtotal_line_items %}
{% for collection in line.product.collections %}
{% if collection.title == 'YOUR_COLLECTION_NAME_GOES_HERE' %}
{% assign show_PDF_link = true %}
{% endif %}
{% endfor %}
{% endfor %}
{% if show_PDF_link == true %}
<p><a href="YOUR_PDF_URL_GOES_HERE">Click here to download your PDF file.</a></p>
{% endif %}
Let me know if this solves your problem or if you need further help!
@BrianAtWork thanks so much! I will try this latest by Tuesday when I’m home again. Will let you know if it works!
Brian
This worked just fine! I tested it yesterday and now we just need to insert it and fine tune a bit.
Much appreciated! It will make our communication much easier!
Evert
Hi Brian how are you? I was looking at this solution but can’t figure out how to execute it if we want to add a different pdf for different products, if we can’t use this coding method, which type of app would I need to do so? Thank’s and I’ll wait for your response. Santiago
It has worked really well for us. the only problem I couldn’t solve is when I tried to have multiple pdf documents or multiple test. ideally I’d like to test each product category and send out the respective document.
Hi there, we created an app that allows you to link different pdf files to products, once a customer places an order, he will get an email with all pdfs for the products they ordered.
let me know if that helps
Hi Brian, I need to add a .bmp file to my Shopify order emails so that I can easily send the order details to a laser engraving machine. I understand this can only be done through coding. Are you able to help me?