Download from external links like Google Drive, etc

Posted by: Pedro Correia

22nd December 2020, 1:47 pm

Pedro Correia

@CasparPT

22 Dec 2020
1:47 pm

Hi,

Loving this plugin, but I'm facing a problem with external files.

I want to make files available to download from a Google Drive account. When I try to use the direct link to a file hosted at a Google Drive account, everything works fine but it downloads a strange file without extension, not the file it was supposed to.

If I paste the link at a web browser, it starts to download immediately.

Any ideas?

  • Developer
    Richard Webster

    @rwebster

    4 Jan 2021
    10:34 am

    The problem with Google Drive links is by default they're a share/view link, not a real download link. For that you need to create your own link (although I think the Google Drive addon for WooCommerce circumvents this need). It's pretty straight forward.

    You could use a website like this: https://sites.google.com/site/gdocs2direct/home

    Or make a URL yourself.

    Sharing links look like this:

    https://drive.google.com/file/d/Some_Download_Id_Number_Here/view?usp=sharing

    Simply take the download ID and add it to a link like this:

    https://drive.google.com/uc?export=download&id=Some_Download_Id_Number_Here

    Hope this helps.

  • Developer
    Richard Webster

    @rwebster

    4 Jan 2021
    10:37 am

    You might also need to set your WooCommerce download method to Redirect.

    EDIT:

    This is the same behaviour you'd see without my plugin, when using the download link for a product someone can purchase and download from their account page.

    Last modified: 4th January 2021, 10:40 am by Richard Webster

This topic is closed to new replies.