The Amazon S3 Storage plugin 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 are having issues with SSL verification, you can disable it by ticking the ‘Disable SSL Verification’ checkbox. Please note that this is not recommended by Amazon and should only be used as a last resort.
- 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.
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 URL’s 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=my_bucket_name object=my_file_name.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=my_bucket object=my_file.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