Support » Plugin: WooCommerce » Downloadable product and custom uploads directory

  • Hi, I have a problem with downloadable products.

    When you try to download a purchased file, it redirects you to the file path under woocommerce_uploads and the .htaccess does its job and forbids the access.

    My uploads directory is outside wordpress, in http://mysite.local/app/uploads/ and wordpress core is in http://mysite.local/wp/

    I think there is something to do in WC_Download_Handler class (woocommerce\includes\class-wc-download-handler.php), at line 170.

    To fix this until then, I just put this code into a php file :

    add_filter('woocommerce_product_file_download_path', function($file_path, $this, $download_id) {
      return str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $file_path );
    }, 99, 3);

    You can also see:

    I hope this will help some people.

  • The topic ‘Downloadable product and custom uploads directory’ is closed to new replies.