The Amazon S3 Storage extension for WooCommerce enables you to serve digital products through your Amazon AWS S3 service.
Using Amazon S3 storage to serve your digital products give you room for better scalability, offers more reliability, specially when serving big files, and greater download speeds for your customers.
Installation ↑ Back to top
- Upload the ‘woocommerce-amazon-s3-storage’ folder to your ‘plugins’ directory.
- Activate ‘WooCommerce Amazon S3 Storage’ through the ‘Plugins’ menu in your WordPress admin area.
- Configure the plugin settings.
Configuration ↑ Back to top
- Go to http://aws.amazon.com
- On the ‘My Account / Console’ menu at the top, select ‘Security Credentials’.
- Copy the ‘Access Key ID’ and ‘Secret Access Key’ and keep them, you will be using them below.
- Go to the ‘WooCommerce -> Amazon S3 Storage’ menu in your WordPress admin area.
- Paste the ‘Access Key ID’ and ‘Secret Access Key’ into the fields.
- If you plan to make your files private, eg. to prevent link sharing, enter an amount in minutes into the ‘URL Valid Period’. This will generate a unique URL to the file on Amazon that will only be valid for the period you specify.
Please note that if you want to keep your files private you need to enter a value in the “URL valid Period” field. Otherwise you need to change the file permissions on Amazon to Everyone for it to work without that settings:
Uploading Files to Amazon Web Services ↑ Back to top
To be able to use Amazon S3 to serve your files, you will need to upload your files to the Amazon S3 service.
- Go to http://aws.amazon.com
- From the ‘My Account / Console’ menu at the top select ‘AWS Management Console’
- Select the ‘S3’ tab.
- If it’s your first time using Amazon S3 you will need to create a bucket. A bucket is a unique identifier and can be set to a specific region, this allows for better latencies, lessen costs and even address regulatory requirements.
- To create a bucket, click the ‘Create Bucket’ button at the top left under the Buckets heading. Give your bucket a name and select the region you would the bucket to be hosted in.
- To upload files, simply click on your bucket in the left hand side and then click the ‘Upload’ button and follow the procedure.
- To make files private/available to anybody, simply click on the file you uploaded and click the ‘Properties’ button.
- There should be a ‘Permissions’ tab at the bottom of the screen, click it and from there you can add/remove permissions. Please note that to keep you files private you will need to remove any Everybody permissions and have an Authenticated permission set up with Open/Download checked.
Configure Digital Products ↑ Back to top
With the introduction of WooCommerce 2.0, there is the ability to offer multiple downloads per product. You must use the [amazon_s3] shortcode in the File URL box for this extension to work.
- Go to the ‘Products -> Products’ in your WordPress admin area.
- Select the product you would like to edit or add a new one.
- On the ‘Product Type’ box makes sure the ‘Downloadable’ checkbox is checked.
- On the ‘Product Data’ box go to the ‘General’ tab.
- Locate the ‘Downloadable Files:’ option.
- Enter your amazon_s3 shortcodes in the ‘File URL’ field box.
- You can enter anything you’d like in the ‘Name’ field box.
- To offer multiple downloads, click on Add File and repeat steps 6 and 7.
Amazon S3 Shortcode ↑ Back to top
You can generate unique download URLs anywhere on your WordPress site using the shortcode to offer unique download URLs to files on your Amazon S3 service.
The shortcode is defined as follows:
[amazon_s3 bucket=MyBucketName object=MyFileName.ext]
You need to specify the two arguments bucket and object for the shortcode to work, where bucket is the bucket name and object is the filename including directory if it is located in a sub directory in the bucket.
To add a download link to a page or posts you can add the following for example
<a href="[amazon_s3 bucket=MyBucket object=MyFile.jpg]">Download File From Amazon</a>
Files Download With Funny Names ↑ Back to top
When you have your store set to make use of ‘Force Download’ and make use of the private URL functionality of the Amazon S3 plugin your files will be get the filename of the URL that gets generated, to get around this you need to set your store to make use of ‘Redirect’ for downloads and optionally just add some meta data to the file on Amazon S3 to make it a specific filename than the one you uploaded it as. By default your file will be downloaded with the name you uploaded it as.
To change the meta data, go to your AWS console, locate the file and then click the properties button. Under the ‘Meta Data’ tab click the ‘Add more metadata’ button, select content disposition from the dropdown and in the value dropdown enter the following: ‘attachment; filename=filename.gif‘ be sure to change filename.gif to the filename the file must be saved as.
WooCommerce 2.0 Support ↑ Back to top
With the release of WooCommerce 2.0 comes significant changes to the downloads functionality. In WooCommerce 2.0 you can now offer multiple downloads per product to your customers, the Amazon S3 extension does support this but now works in a different way then in previous versions of WooCommerce.
Don’t worry about migrating to the new method the extension uses in WooCommerce 2.0 as the extension has a built in updated that will automatically migrate your pre WC 2.0 Amazon settings to the new format.
What this means is that once you activate the new version of the extension on WC 2.0 it will scan through all your previous products that makes use of the Amazon download functionality and convert it to the new shortcode version. You will see once activated that the products will automatically contain a amazon_s3 shortcode in the products File Paths properties.
Audio files playing and not downloading ↑ Back to top
This can be resolved in the same way as the Downloads with funny names issue.
- Login to the S3 console, select an object (in my case, an audio file)
- Select the Properties button (if the properties window at the bottom isn’t already visible).
- Select the Metadata tab.
- Select the Add more Metadata button.
- Select: Content-Disposition in the drop down.
- Enter the Value: attachment
Downloads not completing ↑ Back to top
If you have issues with downloads being slow or it not completing for your customers then be sure to change the WooCommerce Download method to Redirect. You can change this setting under WooCommerce > Settings > Products > Downloadable Products.
Also, make sure that there is no dash or underscore in your bucket and file names
FAQ ↑ Back to top
What happens if I change the bucket’s name? ↑ Back to top
If you need to change the bucket’s name, which is usually done if downloads do not complete, links to downloadable files within emails will no longer work, while links from the My Account page are updated.