$79

WooCommerce R2 Downloads

Buy this

WooCommerce R2 Downloads

$79

Offload your digital product downloads to Cloudflare R2 for fast downloads and a happy server.

Backwards compatible with the WooCommerce S3 Storage plugin so you can migrate to this easily!

R2 has much much cheaper outbound data (egress) than AWS S3 or Cloudfront so it is a great choice for digital downloads.
Some websites can reduce their spending by thousands of dollars a year - check out the R2 calculator here.

Used on high traffic production sites from day 1 so this is battle tested and ready to go.

How is Cloudflare R2 able to offer this service at a price that undercuts AWS S3 by so much? Bandwidth for providers isn't billed by the gigabyte like you are on AWS so at certain scales the costs involved are completely different shapes. Read up on that here.


Usage instructions

First you should upload your products to R2. I like using Cyberduck to make life easy.

In the File URL field in WooCommerce, use the following shortcode:

[cloudflare_r2 bucket="my-bucket" object="path/filename.ext"]

Because this plugin is backwards compatible with WooCommerce S3 Storage you can also use their shortcode:

[amazon_s3 bucket="my-bucket" object="path/filename.ext"]

If you specify the default bucket in your settings you can skip the bucket field.

Setup Instructions

For now this plugin takes its configuration as settings in wp-config.php. Set them up like so:

define('CF_ACCESS_KEY', '');
define('CF_ACCESS_SECRET', '');
define('CF_ACCOUNT_ID', '');
define('CF_DEFAULT_BUCKET', '');

It is best if WooCommerce is setup to use the Redirect download method.
You can do this under WooCommerce -> Settings -> Products -> Downloadable Products and ensure File download method is set to Redirect only.
Your products are still fully secure and links are only valid for 1 hour by default.

Then either upload your files to R2 or migrate them from S3 to R2.

If you are unsure how to update your wp-config.php or your host does not let you, please contact me and I will sort something out for you.

URL Validity time

If you want to change the time period that the URL is download valid for you can use CF_URL_PERIOD to specify how many minutes links should be valid for:

define('CF_URL_PERIOD', 15); // 15 minutes

Bucket mapping

In case your buckets are named differently between AWS and R2 you can use CF_BUCKET_MAP to automatically convert for new requests.

define('CF_BUCKET_MAP', 'your_aws_bucket1:your_r2_bucket1,a_diff_aws:new_r2_bucket');
  • your_aws_bucket1 -> your_r2_bucket1
  • a_diff_aws -> new_r2_bucket

Support

If you need any help at all I answer emails quickly and at no cost to help you resolve any issues with the plugin. Please send through as much information as you can in your initial email.

More complex help is available and will be billed at an hourly rate.

Future updates

  • If this plugin gets a reasonable number of downloads I promise I will build a settings page
  • If you would like a Backblaze B2 variant please send me an email!
Buy this

woocommerce-r2-downloads-1.0.0.zip

Tested WooCommerce Version
Up to 8.7
PHP Version
>=7.4
Size
5.32 MB
Copy product URL