If you have just installed WooCommerce or have upgraded to version 6.5 you will have seen a message informing you that the list of approved download directories has been updated.
You will have this list of approved download directories in a new setting under WooCommerce → Settings → Products → Approved Download Directories.
Depending on your configuration you will see a series of paths to file upload directories, which are the ones WooCommerce uses by default to upload both product images and files for digital downloads.
These directories can be enabled or disabled, depending on your decision as to which of these directories can be used to host digital downloads.
What is the list of approved download directories for?
WooCommerce creates a folder called woocommerce_uploads inside the WordPress file upload folder, which is where product files with digital downloads are uploaded by default.
This is convenient but does not always suit the needs of your business or company.
There are several reasons why you might want to specify the directories where the digital download files you sell in your e-commerce will be stored:
- Company security policies.
- Company storage policies.
- Customized backup management.
- Prevent store managers from using their own external domains or hosting.
- Avoid using private cloud hosting.
Remember that adding a download file for a digital product does not require uploading via the WordPress media uploader of the product editor, any user with product creation or editing capabilities can enter direct URLs, of any type and in any location, to downloadable files, such as their Dropbox account, Google Drive, or any domain, as long as the file exists.
The management of approved download directories does not affect the upload of product images at all, which will continue to use the default WordPress upload directory (/wp-content/uploads/) or the one you configure.
What can I configure and how in the approved download directory list?
Now that we have understood what this approved download directory tool is for, let’s take another look at the settings screen…
The screen is just like any other WordPress content listing screen, there are no mysteries here, with its links for batch actions, selection, etc. But there are a few more things.
Apply or stop the application of rules
To start with there is a big button to “Start enforcing rules“, and by default, no rules are applied to change the default behavior of WooCommerce, it doesn’t matter if the existing directories in the list are listed as enabled or disabled, if you don’t start applying rules the digital downloads can be uploaded to the usual default locations.
When you have applied the rules by clicking this button, the permissions rules (enabled or disabled) of the directories in the list will start to be applied, and the button will change to “Stop applying rules“, so this is a reversible process.
List of download directories
Continuing with the screen, in the list of directories there can be different URLs:
- Full visible URL: Here you can see the visible URL of the downloads, with your domain. For example: https://yourdomain.com/files/digital-downloads/.
- Incomplete visible URL: If you prefer, it also supports URLs without the protocol, for example //yourdomain.com/files/digital-downloads/.
- Complete internal path: If you prefer, you can put the complete internal path of the server, preceded by file:///(note that there are 3 slashes). For example: file:///home/customers/yourdomain/public_html/wp-content/uploads/woocommerce_downloads/.
Download directory rules
And some rules you should know:
- http is different from https, so you can have paths from the same domain with and without SSL.
- If you add a directory all its subdirectories will also be able to host digital downloads. So, if you add https://yourdomain.com/files/ the folder https://yourdomain.com/files/other-folder/other-subfolder/ will also be approved for hosting digital downloads.
- The settings of the list of approved download directories can only be modified by a user with administrator profile.
Enable or disable download directories
The basic process for approving or disapproving directories is to enable or disable them. You can edit or quick edit the directory to change its status, or use bulk actions, whichever you prefer.
Then, when you are done, if you want to you can start the application of the rules you have configured (activated and deactivated).
Add or remove download directories
To start with the easiest, removing download directories is as simple as clicking on the “Delete permanently” action link that is displayed when hovering over it in the listing or from the batch actions.
And, well, it’s not that adding directories is difficult, just click the “Add new” button, put in the URL and check the box for enabled or not, little mystery here too.
In addition to this settings screen you have 2 more additional tools on the “WooCommerce → Status → Tools” page, where you are going to be able to:
- Synchronize approved download directories – If you click on the refresh button, WooCommerce will scan all products with digital downloads and if it finds paths it will add them to the list of download directories, so you can then enable or disable them. This can be especially useful if you load products with import plugins, and it never hurts to do this check before applying download directory rules.
- Empty the list of approved download directories – Clicking the clear button will clear all existing paths from the list of download directories, so you can:
- Synchronize the download directories and then apply the rules.
- Add directories manually.
What happens if I apply approved download directory rules?
This is the important thing, should I start applying the directory rules that the listing shows me, will it break any existing downloads?
The key thing to keep in mind is this:
- If a download directory appears in the list it means that there are current downloads in that path, so if it is disabled and you start applying rules it will stop downloading. If you want to keep the current downloads from that directory you’d better enable it.
- If a download directory is not listed but there are files uploaded to its path those downloads will stop working. If you want downloads from that directory that is not shown in the list to work add it to the list before applying the rules.
- If a directory, domain or path is not in the list of approved download directories no user will be able to add downloads from that directory, domain or path.
If you apply the rules and a path is not in the list you will see an error message, and the download will not work, no matter if it is a new or previously existing download file.
So do I use the WooCommerce approved directory rules or not?
Basically, you have 3 options when it comes to using the WooCommerce approved downloads directory:
- Do nothing, don’t add or remove directories to the list, but especially don’t click the “Start applying rules” button and digital downloads in WooCommerce will work as usual, being able to put any URL.
- Apply the rules and review the paths of all previous digital downloads that are associated with unapproved directories, changing the URLs to approved directories (prior hosting of the file, of course), adding the missing ones and disabling the ones you don’t want to be used. This is the safest thing to do, and the goal of the tool, that you have full control of the hosting of the digital downloads you offer in WooCommerce.
- Add the existing paths to the list of approved directories, and then you don’t have to do anything, all existing rules will work, you avoid URLs messing up, but you will still have downloads on less controlled, perhaps less secure paths.
Is it worth using WooCommerce approved download directories?
Yes, I think it’s a great addition, especially if your e-commerce has several online store managers and you want to control where your digital downloads are hosted and from where they are served.
If you manage the store by yourself, you may not need this kind of control, unless you want to apply some specific strategy of controlled storage of downloads, something that never hurts, and perhaps the fact of having this tool should make us think about it, and in fact I myself am thinking about it.