Hello everyone,
By default, WooCommerce does not allow .webp images via API to be uploaded. However, we found a solution using our Bulk Product Sync plugin. If you’re encountering an error message similar to “Sorry, you are not allowed to upload this file type” when trying to upload WebP images in WooCommerce, you can follow the steps below:
1- Add the following code to your functions.php file:
function add_additonal_wc_mime_types($mime_types) {
$mime_types['webp'] = 'image/webp';
return $mime_types;
}
add_filter('woocommerce_rest_allowed_image_mime_types', 'add_additonal_wc_mime_types', 1, 1);
2- Save the changes to your functions.php file.
This code adds support for the WebP image format, allowing you to upload WebP images via the WooCommerce API. If you’re not comfortable editing your functions.php file, you can also use a plugin such as Code Snippets.
For more information about this solution, you can visit this link: https://stackoverflow.com/questions/73088987/invalid-image-sorry-you-are-not-allowed-to-upload-this-file-type-in-woocommer
We hope this helps! If you have any questions, feel free to ask in the comments below.