Adding a download button to your WooCommerce product page is a great way to offer digital products for sale. There are two methods you can use to add a download button to your product page.
The first method is to use a plugin, and the second method is to use code.
Method 1: Using a Plugin
There are a few plugins that you can use to add a download button to your WooCommerce product page. One option is the ‘WooCommerce Product Downloads’ plugin.
This plugin is free and available for download from the WordPress repository. Once installed and activated, you will need to configure the plugin settings.
To do this, go to WooCommerce > Settings > Products > Downloads tab. From here, you can set up the file downloads for your products. You will need to upload your digital file to the WordPress media library and then copy and paste the URL into the ‘File URL’ field.
In the ‘Access Restrictions’ section, you can choose who has access to the download file. By default, only logged in users will have access but you can also give access to specific user roles or allow anyone to have access.
Once you have configured the plugin settings, you can then add the download button to your product pages.
To do this, edit your product and scroll down to the ‘Product Data’ section. In the ‘Downloadable Files’ section, click on the ‘Add File’ button.
This will open up the WordPress media library where you can select your downloadable file. Once selected, click on the ‘Insert into post’ button.
You will then see your downloadable file listed in the ‘Downloadable Files’ section. You can repeat this process for multiple files if needed. Once you have added all of your files, scroll down and publish your product.
Method 2: Using Code
If you don’t want to use a plugin, then you can add a download button to your WooCommerce product page using code. First, you will need to upload your digital file(s)to the WordPress media library and then copy and paste the URL into your product page code.
Download
(Replace "file-url" with the URL of your downloadable file.)
.
(Replace "1" with the ID number of your downloadable file).
[download#2]
(Replace "2" with the ID number of your downloadable file).
You can also add an image next to your download button by using this code:
.
Download