Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/morvy/cloudflare-r2-for-woocommerce/archive/refs/heads/master.zipSimple integration to serve WooCommerce downloadable product files from Cloudflare R2 storage using shortcodes.
What This Plugin Does
- Adds a simple popup to choose a file from R2 or upload a new file to R2
- Adds R2 files to WooCommerce products using shortcodes
- Generates secure pre-signed URLs with expiration
- Uses WooCommerce's native download permissions and tracking
- Caches R2 file listings for better performance
What This Plugin Does NOT Do
- No file management (upload/delete/rename)
- No custom analytics or tracking
- No custom access control (uses WooCommerce's system)
Requirements
- WordPress 6.4+
- WooCommerce 9.0+
- PHP 8.2+
- Cloudflare account with R2 enabled
Installation
- Download the latest release ZIP from Releases
- Go to WordPress Admin > Plugins > Add New > Upload Plugin
- Upload and activate
Configuration
Get R2 Credentials
- Log in to Cloudflare dashboard
- Navigate to R2 > Manage R2 API Tokens
- Create API token and note:
- Endpoint:
https://<account-id>.r2.cloudflarestorage.com - Access Key ID
- Secret Access Key
- Bucket Name
- Endpoint:
Configure Plugin
- Go to WooCommerce > Settings > Cloudflare R2
- Enter credentials
- Test connection
- Save
Usage
Adding Files to Products
- Upload files to R2 bucket using Cloudflare dashboard or S3 tools or via popup
- Edit WooCommerce product > Enable Downloadable
- Add file using Choose/Upload buttons or directly with a shortcode:
[cloudflare_r2 object="path/to/file.zip"]
Shortcode Syntax
Basic:
[cloudflare_r2 object="path/to/file.zip"]
Custom filename:
[cloudflare_r2 object="path/to/file.zip" filename="Download.zip"]
Custom expiration (seconds):
[cloudflare_r2 object="path/to/file.zip" expires="7200"]
Legacy syntax for various Amazon S3 plugins (backward compatibility):
[amazon_s3 bucket="my-bucket" object="path/to/file.zip"]
Parameters
object- File path in bucket (required)bucket- Bucket name (optional, uses default)filename- Download filename (optional)expires- Link expiration in seconds (optional, default: 3600)
How It Works
- Customer purchases product with R2 file
- WooCommerce verifies purchase permissions
- Plugin generates pre-signed URL from R2
- Customer downloads file securely
- WooCommerce tracks download
FAQ
Q: How do I upload files? A: Use Cloudflare dashboard, AWS CLI, or any S3-compatible tool or via a popup interface in plugin.
Q: How do I manage files? A: Use external tools. Plugin only uploads files and generates download links.
Q: Is this secure? A: Yes. WooCommerce controls access. Only verified purchasers can download. URLs expire after set time.
Q: Can I use with Subscriptions? A: Yes. WooCommerce Subscriptions access control works automatically.
Q: Does it cache files? A: No. It caches file listings from R2 for performance.
Support
- Create issue in this repository
License
AGPL-3.0-or-later
For development documentation, see CONTRIBUTING.md.