WordPress.org

Forums

WooCommerce - excelling eCommerce
Downloadable product and custom uploads directory (1 post)

  1. chknwng
    Member
    Posted 1 year ago #

    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:
    https://github.com/woothemes/woocommerce/issues/4519

    I hope this will help some people.

    https://wordpress.org/plugins/woocommerce/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic