title: WooCommerce: give user access to downloadable files when the status is on-hold
body: <p>Q: I want to have my customer to have access to the downloadable products when the status of his order is 'on-hold'.</p>
  <p>When a customer places an order for a downloadable product AND a physical product, I sometimes want to place the order in the on-hold status (by hand). But then the customer can not download the downloadable product.</p>
  <p>The grant access is regulated in woocommerce/includes/wc-order-functions.php (2.2)</p>
  <pre><code>/**
   * Order Status completed - GIVE DOWNLOADABLE PRODUCT ACCESS TO CUSTOMER.
   *
   * @access public
   * @param int $order_id
   */
  function wc_downloadable_product_permissions( $order_id ) {
      if ( get_post_meta( $order_id, '_download_permissions_granted', true ) == 1 ) {
          return; // Only do this once
      }
      $order = wc_get_order( $order_id );
      if ( $order &amp;&amp; $order-&gt;has_status( 'processing' ) &amp;&amp; get_option( 'woocommerce_downloads_grant_access_after_payment' ) == 'no' ) {
          return;
      }
      if ( sizeof( $order-&gt;get_items() ) &gt; 0 ) {
          foreach ( $order-&gt;get_items() as $item ) {
              $_product = $order-&gt;get_product_from_item( $item );
              if ( $_product &amp;&amp; $_product-&gt;exists() &amp;&amp; $_product-&gt;is_downloadable() ) {
                  $downloads = $_product-&gt;get_files();
                  foreach ( array_keys( $downloads ) as $download_id ) {
                      wc_downloadable_file_permission( $download_id, $item['variation_id'] &gt; 0 ? $item['variation_id'] : $item['product_id'], $order, $item['qty'] );
                  }
              }
          }
      }
      update_post_meta( $order_id, '_download_permissions_granted', 1 );
      do_action( 'woocommerce_grant_product_download_permissions', $order_id );
  }
  add_action( 'woocommerce_order_status_completed', 'wc_downloadable_product_permissions' );
  add_action( 'woocommerce_order_status_processing', 'wc_downloadable_product_permissions' );
  </code></pre>
  <p>What do I have to change to accomplish this?</p>
  <p>14-07-2016 UPDATE</p>
  <p>I have paid a coder for helping me out. This is the code where I was looking for. Add this code to your functions.php:</p>
  <pre><code>function add_onhold_status_to_download_permission($data, $order) {
      if ( $order-&gt;has_status( 'on-hold' ) ) { return true; }
      return $data;
  }
  add_filter('woocommerce_order_is_download_permitted', 'add_onhold_status_to_download_permission', 10, 2);
  </code></pre>