woocommerce_downloadable_file_hash

The WooCommerce woocommerce downloadable file hash hook.

Description

apply_filters( 'woocommerce_downloadable_file_hash', (unknown) $md5, (unknown) $this_get_id, (string) $download_name, (unknown) $download_file, (unknown) $download_previous_hash ); 

Parameters (5)

0. $md5 (unknown) => md5( $download['file'] )
The md5.
1. $this_get_id (unknown)
The this get id.
2. $download_name (string)
The download name.
3. $download_file (unknown)
The download file.
4. $download_previous_hash (unknown)
The download previous hash.

Usage

To run the hook, copy the example below.
  1. $md5 = apply_filters( 'woocommerce_downloadable_file_hash', $md5, $this_get_id, $download_name, $download_file, $download_previous_hash ); 
  2.  
  3. if ( !empty( $md5 ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_downloadable_file_hash callback 
  2. function filter_woocommerce_downloadable_file_hash( $md5, $this_get_id, $download_name, $download_file, $download_previous_hash ) { 
  3. // make filter magic happen here... 
  4. return $md5
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_downloadable_file_hash', 'filter_woocommerce_downloadable_file_hash', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_downloadable_file_hash', 'filter_woocommerce_downloadable_file_hash', 10, 5 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/abstracts/abstract-wc-product.php  
  1. $file_hash = apply_filters( 'woocommerce_downloadable_file_hash', md5( $download['file'] ), $this->get_id(), $download['name'], $download['file'], $download['previous_hash'] );