Sell Protected Files with WooCommerce
Goal: only customers who paid can download the file
WooCommerce runs the checkout, payment, and order management. Media Guard delivers the file after the order is complete. It’s the secure-delivery layer most stores miss.
The bouncer model. Think of Media Guard as a friendly bouncer outside a private club. Your files live in a locked back room only the bouncer can open. When someone asks for a file, the bouncer checks their ID (are they logged in? do they have the right pass?) before opening the door.
Why not just use WooCommerce’s built-in downloads?
Because WooCommerce’s built-in download links are easy to scrape, share, or leak. They’re really just signed URLs to files in your Media Library — which can be discovered. Media Guard puts the file in a directory the web server can’t reach, and streams it through PHP only after checking the buyer’s order.
Don’t use both on the same file. Pick one. We recommend Media Guard.
Before you start
- WooCommerce is installed and your checkout works (even a free product is fine for testing).
- Media Guard is installed and activated.
Step 1 — Create a Virtual product (not Downloadable)
In WooCommerce, go to Products → Add New. Fill in the name and price. In the Product data box, check Virtual. Leave Downloadable unchecked — Media Guard will do that part.
Publish the product. Note its title — you’ll need it.
Step 2 — Upload the file to Media Guard
Go to Media Guard → File Manager and drag your file (PDF, ZIP, MP3, MP4 — whatever you’re selling) into the upload zone.
Step 3 — Place the protected shortcode on the customer-facing page
The most common place is the order-received / thank-you page or a customer dashboard page. You can also email it inside a custom WooCommerce email.
Use this shortcode pattern (the product slug is in the URL of your WooCommerce product page):
[mediaguard file="your-product.pdf" product="your-product-slug"]
Customers who have completed an order for that product will be able to open the file. Everyone else will be denied.
Step 4 — Test it
- In an Incognito window, try to open the file directly via its URL — denied.
- Place a test order using a sandbox payment gateway (or set the order to Completed manually in WooCommerce).
- Log in as that customer and visit the page with the shortcode — file opens.
FAQ
Does it work with WooCommerce Subscriptions? Yes. Access is granted while the subscription is active and revoked when it lapses.
Does it work with variable products? Yes — you can tie the shortcode to either the parent product or a specific variation slug.
Can I sell a whole library of files in one purchase? Yes, two ways: (1) put multiple shortcodes on the post-purchase page, or (2) use a Group (Pro) and grant group membership on order completion via Automator.
What about refunds and chargebacks? Access is checked on every file open. The moment WooCommerce changes the order status away from Completed, access stops.
Common mistakes
- Using WooCommerce “Downloadable files” and Media Guard on the same file. They will fight each other. Pick one — Media Guard is the secure path.
- Marking the product Physical instead of Virtual. WooCommerce will calculate shipping and confuse the checkout.
- Putting the shortcode on a public page. The protection works file-side, not page-side. But if the page itself contains a download link that anyone can copy, you’ve given the URL away. Always put the Media Guard shortcode on a logged-in/customer-only page.
Related Pro features
Selling protected files on WooCommerce? Pro is built for this.
- Pro Features Tour — See the full set of WooCommerce-aware Pro features.
- shortcode — Give each customer a personal downloads page they can come back to.
- Agency Features — If you build WooCommerce sites for clients, Agency licenses cover unlimited installs.