Search

Solved: WooCommerce Download Link Not Showing

Listen to this article

WooCommerce is undoubtedly a very famous plugin, to sell products from your WordPress e-stores. It supports the selling of physical, as well as downloadable or virtual products. Recently, while trying to set up a store with WooCommerce to sell digital products, for a client project, we found that the download links for products were not generated, even after the payment was successful.

WooCommerce-Order-Without-Download-Link
WooCommerce Order Email Without Download Link

 

The Ideal Scenario

Generally what should happen is, if a customer comes to your site, selects a downloadable product, and purchases it, the email that goes to the client from WooCommerce, should contain the link to download the purchased product. Not only this, after being redirected to your site upon making a successful payment, the download link should be shown to a user on the website, so that the user can directly download the product.

Download-Link-Order-Email-WooCommerce
Download Link in Order Email

But in our case, none of this was happening. The download link was neither present in the email, nor available on the site.

While debugging the issue, we found out the cause. The WooCommerce table which stores user downloading permissions, ‘woocommerce_downloadable_product_permissions’, was not created. The download links, shown to the user, are generated using this table.

Tables-In-WooCommerce
Tables in WooCommerce

 

We would like to specify here, that the solution provided by this article, has been tested only for a Single site WordPress installation and not for WordPress Multisite (WPMU/WPMS) installations. Most Importantly make sure you BACKUP your entire DATABASE, before performing the following database related operations. Hence you can always revert to it in case anything is messed up.

A Note About WordPress Database Table Name Prefix

As a good practice, all plugins when creating their own database tables, use the WordPress database prefix, specified in the wp-config.php. Following the same rule, WooCommerce also generates all tables with the mentioned prefix. Hence, if database prefix mentioned in wp-config.php is ‘wp_’, then the table created by WooCommerce will be named, wp_woocommerce_downloadable_product_permissions.

To find out your database prefix, open up wp-config.php file present in the root directory of WordPress and search for the line ‘$table_prefix = ‘. Value assigned to the variable table_prefix is your database prefix.

[space]

How did the Prefix Affect Our Use Case?

Coming back to the topic, WooCommerce or any other plugin which generates own tables will fail to create tables if the length of table names exceeds 64, because 64 is the maximum length for table names as specified by MySQL.

MySQL-Schema-Object-Names
MySQL Schema for Object Names

In our case, database prefix set by the client, itself was greater than 20 characters! Hence, the entire table name exceeded 64 characters and WooCommerce table woocommerce_downloadable_product_permissions was not created. We knew we had to change the database prefix to something else. Definitely something much less than 20 characters.

 

Changing the Database Prefix

Important: Database prefix should not be changed by directly editing wp-config.php. Doing so, may break the site.

The article, on changing database prefix, explains a reliable way to change the database prefix manually, in the section ‘Changing default table prefix after Installing WordPress’. Alternatively, you could use a plugin, like Change DB Prefix to achieve the same results.

After changing the database prefix, deactivate the WooCommerce plugin and activate it again, to ensure that the tables are created. This solved our issue, and should solve your problems too. Do you have a better method to solve this issue or is your problem still not solved? If yes, feel free to let us all know about it by commenting below.

Sumit Pore

Sumit Pore

23 Responses

  1. I checked, and the client has the table woocommerce_downloadable_product_permissions but the product/s don’t display on the order received page.

    Any ideas?

    Thanks Sumit

  2. thanks guy
    table “woocommerce_downloadable_product_permissions” exist but i haven’t download link in account page and haven’t product’s details email .
    do you have another way ?

  3. Similar issue. Table exists, entry exists, download link in email exists BUT no download link on order page on website. Any ideas? Thanks.

  4. This worked for me. I am extremely thankful and I wish you, Sumit, a long and prosperous life 🙂
    A ridiculously long table name + a ridiculously long DB-prefix… a real unnecessary problem…
    So thanks, I could never have worked this out myself.

  5. Hi guys, any chance you could also describe how to change the font size of that ‘Product Download Link’ you mentioned above, because it is really hard to see, it took me a while to figure it out and I am the seller 🙁 I have searched all code and can’t find out where to change this just for this link, it is way too small on my page, it would be better if it was a button but I would be happy with a much larger font. Thanks Michelle

  6. I found that if I clicked Return to Merchant IMMEDIATELY after the PayPal payment was successful, there will be no link. If I want approximately 15 seconds before pressing the Return to Merchant link, then the download link is there. Perhaps it takes some time for PayPal to tell the shopping cart that payment was successful and therefore to release the link?

    The email that arrives very fast has the link 🙂

  7. So I noticed that this solution doesnt always work becuase in some cases the table permission have been created yet the problem persist, are there any other solutions for fixing this problem.

  8. Hi I would be grateful if someone can help me.
    My problem is my site generating link and all but my customer are mostly buying from phones and when they complete their purchase they get email that have link to download but if they click to download it, it is not getting saved or downloaded in phone . While in pc it is very simple

    Is there anyway I can resolve this ?. My downloadable images are jpg format .
    Thanks in advance

  9. Hello hope I aint late on this but have same issue where for free download the link is there but for paid I have tried even automated orders but still not able, changed prefix but still not able

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

WordPress Development

Custom WordPress Solutions, for You

LearnDash Development

Custom LearnDash Solutions, for You

WooCommerce Development

Custom WooCommerce Solutions, for You

WordPress Plugins

Scale your WordPress Business

WooCommerce Plugins

Scale your WooCommerce Business

LearnDash Plugins

Scale your LearnDash Business

Label

Title

Subtext

Label

Title

Subtext

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads