WooCommerce and TranslatePress: Fixing Download URL Issues for Translated Sites

translation, keyboard, computer

Handling download URL issues on a multilingual WooCommerce site using TranslatePress can be challenging. For store owners selling digital goods, encountering broken links or damaged downloads in secondary languages can disrupt customer experience.

A user in the Business Bloomer Club recently reported a problem where the default email for a completed order included a damaged PDF link in the translated Hungarian version of the site. The issue boiled down to the added language slug (/hu/) in the download URL.

This raises important questions: How can you resolve URL conflicts in TranslatePress to ensure proper file downloads? Are there alternative solutions or workarounds to prevent the addition of the language slug in specific scenarios?

Below, we explore potential fixes for this issue, including troubleshooting the plugin and implementing custom rules to maintain functional download links across languages.

Continue reading WooCommerce and TranslatePress: Fixing Download URL Issues for Translated Sites

Protecting Downloadable PDF Files in WooCommerce for Logged-In Customers

In a recent Business Bloomer Club Slack thread, WooCommerce store owners discussed ways to secure downloadable PDFs stored in the Media Library, aiming to restrict access to logged-in users who purchased the files.

While some accepted the reality that determined users can often find ways around restrictions, several solutions offer improved security to protect digital downloads.

Continue reading Protecting Downloadable PDF Files in WooCommerce for Logged-In Customers

WooCommerce: Fix “Sorry, This File Type Is Not Permitted for Security Reasons” For Downloadable Products

In WordPress, you get the “Sorry, This File Type Is Not Permitted for Security Reasons” error when you try to upload certain files to the Media library. Similarly, in WooCommerce you may get the same error when you try to upload a downloadable product download files.

Why is that? Well, by default WordPress only allows certain file extensions to be uploaded to the site. For example PNG, JPG, PDF, PPT, DOC, MP3 and MP4 are within the allowed file types – the reason being they are “safe” and won’t contain malicious code that could create problems within a WordPress install.

The thing is – I’ve started selling my first downloadable product (a mini-plugin) here on Business Bloomer and I needed to upload a ZIP file (the mini-plugin), a JSON file (a Code Snippet export file for those who don’t like plugins) and a TXT file (the plugin’s raw code for those who like to play with PHP). All went smoothly for the ZIP upload, but as soon as I tried uploading the JSON and TXT files I got the “Sorry, This File Type Is Not Permitted for Security Reasons” error.

Panic? Not really. It’s only a matter of finding the right code to change this default WordPress behavior. So, say hello to the “upload_mimes” filter, which allows us to do just that. Enjoy!

Continue reading WooCommerce: Fix “Sorry, This File Type Is Not Permitted for Security Reasons” For Downloadable Products

WooCommerce: Get List of Downloadable Products (PHP)

When you’re doing custom PHP work, this snippet will come in handy. It’s a quick way to get a sub-list of product IDs based on product meta criteria – in this case we’ll get a list of products that have “_downloadable” set to “yes” (which, in plain English, means they are “downloadable“).

Of course, you can use wc_get_products to get any sub-list of product IDs, for example in stock products, products by custom field value, products by category, products by tax class, and so on. Enjoy!

Continue reading WooCommerce: Get List of Downloadable Products (PHP)