Need Help?

How to add EPUB & MOBI eBooks on WooCommerce as downloadable products?

How to add EPUB & MOBI eBooks on WooCommerce as downloadable products_

I’ve helped set up a number of WordPress-based commerce sites for authors. One of the first things that always gets in the way is the inability to upload MOBI or EPUB file into WooCommerce to actually set the books.

Getting around this is a pretty simple process.

  1. In wp-content/plugins, create a directory like local-upload-ebooks.
  2. Create local-upload-ebooks/local-upload-eboooks.php and edit it.
  3. Put the text below into it and save it.
  4. Go into your Plugin Manager and enable the plugin.
 Plugin Name: Upload Ebooks
 Version: 0.0.0
 Author: D. Moonfire
 Description: Enables uploading ebooks into WordPress and WooCommerce.

// Add in a hook to add the taxonomies and categories.
add_action('init', 'upload_ebook_init', 0);

function upload_ebook_init()
  // This allows up to add the MIME types that can be uploaded.
  add_filter('upload_mimes', 'upload_ebook_upload_mimes');

  // These are completely arbitrary and probably too big.

  // Ebooks sometimes take a little longer to upload.

function upload_ebook_upload_mimes($mimes)
  $mimes = array_merge($mimes, array(
    'epub' => 'application/epub+zip',
    'mobi' => 'application/x-mobipocket-ebook'

  return $mimes;