In this article, we will show you how to protect and sell WooCommerce products stored in Wasabi bucket.
- WordPress Amazon S3 Smart Upload version 1.1.0 and greater
- PDA S3 Integration version 184.108.40.206 and greater
- Prevent Direct Access (PDA) Gold version 3.1.0 and greater
1. Upload files to Wasabi bucket
You can upload files directly to Wasabi bucket via Wasabi management console or from your WordPress admin dashboard.
To upload files without leaving the admin dashboard, please follow the steps below:
Step 1: Go to Media >> S3 Smart Uploads menu and configure your Wasabi bucket.
Step 2: Once done, reload this page and start uploading your files.
Tick the “Show it under Media Library” box if you want to add the uploaded files to your media library. Once added, these Wasabi files can be managed like other WordPress media files. You can insert them into WooCommerce products, for example.
You can also select the upload destination folder from the dropdown as below.
Alternatively, you can simply choose the desired folder from your Wasabi bucket folder structure and hit the Upload File button.
Please note that if you define the
SSU_FOLDER with a non-existing name, our plugin will create a new folder with this name for you. In additional, the upload directory will display all files in this folder by default.
All files uploaded via our plugin will be private by default. That means no one can access these files directly even though you grant public access to your bucket. Tick on the “Make it public” checkbox if you want the file to become publicly accessible after upload.
File size limit
SSU Lite version allows up to 512 MB of file upload size. You might need to get Prevent Direct Access Gold to upload larger files, up to 5GB per file.
Removing the file’s copy in the Media Library won’t affect its original version in the Wasabi bucket.
If you want to delete files on Wasabi bucket when deleting its copy under Media Library, add the following code to your wp-config.php file.
define( 'SSU_WP_REMOVE', true );
It’s important to note that you can remove all files under
Wasabi uploads will display in the right sidebar. Simply right-click on the filename to copy the file URL, present it under Media Library or make the file public.
Upload files from frontend
[ssu_upload] shortcode to display an upload button allowing users to upload files to your Wasabi bucket directly.
2. Sell WooCommerce products using Wasabi URLs
Since version 1.3.0, you can upload a file to Wasabi buckets directly from WooCommerce or Dokan dashboard.
Simply click on the “Offload to S3” button and select the file you want to sell via WooCommerce. The process is similar to when you upload files via our plugin’s dashboard.
For SSU version 1.2.0 and below
Step 1: Create or edit a WooCommerce product
Step 2: Insert the Wasabi file URL in “Downloadable files” field
Step 3: Click Publish or Update to save your files
Once a customer purchases your products, they will receive protected files via Wasabi links which will automatically expire after 60 seconds by default.
Logic & Limitations
- You can change the expiration time of these pre-signed URLs by customizing SSU_SURL_EXPIRY value. Let’s say you want the signed URLs to automatically expire after 10 seconds, simply change “60” to “10” in the line below under your wp-config.php file.
define('SSU_SURL_EXPIRY', 60); // 60 seconds
- You can restrict file access using both Wasabi signed URLs and built-in WooCommerce functions.
WooCommerce will check the user permission and generate a WooCommerce link. As long as the WooCommerce link is valid, our plugin will redirect it to a Wasabi link which will expire after a period of time.
- You can also force users to download the file by choosing the “Force downloads” option under WooCommerce >> Settings >> Products >> Downloadable products page.