How to make a linka direct download PNG or PDF?

RenatoMP
Visitor
2 0 0

Hello,

 

I use the Minimal theme and recently i've been working with a friend making this page inside my clothing store website. Its a "coupon" type page. We are struggling figuring out how to make a link  a direct download for anyone who click it.

 

For anyone that is kind to help me please you have to login before you can see the link. You just have to click "obtener descuento" and then "descargar cupon". This last one is the one we want to be a direct download link instead of another tab.

 

https://mehperu.com/pages/compraperu#

 

Thank you so much!

Replies 5 (5)

ScreenStaring
Shopify Partner
56 2 10

Having to create an account and login to see the page will likely discourage people from helping. 

 

In either case the first thing to do is  upload the PDF to your site. After uploading you can get the URL of the asset (see the documentation I just linked) to.

 

Is the page you want the link to appear on a Page or a part of product Liquid template?

 

If a Page, see the section here on adding a link.

 

If it's in Liquid you'll have to add the following to the appropriate template:

 

{{ 'Download Coupon' | link_to: 'https://cdn.shopify.com/s/files/path-to-your.pdf' }}

 

Or if the PDF's contents can change often but file's name remains the same:

 

{% assign pdf = 'size-chart.pdf' | file_url %}
{{ 'Download Coupon' | link_to: pdf }}

 

ScreenStaring
Software Development & Consulting
Vnsa
Excursionist
33 0 13

Thanks for the instructions and links - easy to follow !

William123
Visitor
1 0 0

Hi all,

Could you please let me know how to create a download link that customer can directly download the file when they click on the link rather than opening inside the browser.

For example as below image, customer clicks on the "size guide", then the PDF file can be downloaded directly, rather than opening a new browswer, and click download button inside.

Thank you.

ps, here is my store: www,limkoocycling,com in debut shopify.

 
HandHugs
Shopify Expert
198 1 60

the only way to force the download would be to have it in a ZIP folder - shopify serves all its images and files from their CDN which disqualifies it from instant download markup. You would need to zip the file/files into a .zip format and then link to that in your code.

 

* Chrome 65+ and Firefox only support same-origin download links.

 

https://www.w3schools.com/tags/att_a_download.asp

made4Uo
Shopify Partner
3804 713 1124

Hi, 

 

This is doable in Shopify. Please check the video for more info.

 

Volunteering to assist you!  Likes and Accept as Solution  is highly appreciated.✌
Coffee fuels my dedication. If helpful, a small Coffee Tip would be greatly appreciated.
Need EXPERIENCED Shopify developer without breaking the bank?
Hire us at Made4Uo.com for quick replies.
Stay in control and maintain your security by avoiding unnecessary store access!