woocommerce_download_file_(file_download_method) хук-событиеWC 1.0

Trigger download via one of the methods.

Использование

add_action( 'woocommerce_download_file_(file_download_method)', 'wp_kama_woocommerce_download_file_method_action', 10, 2 );

/**
 * Function for `woocommerce_download_file_(file_download_method)` action-hook.
 * 
 * @param  $file_path 
 * @param  $filename  
 *
 * @return void
 */
function wp_kama_woocommerce_download_file_method_action( $file_path, $filename ){

	// action...
}
$file_path
-
$filename
-

Где вызывается хук

WC_Download_Handler::download()
woocommerce_download_file_(file_download_method)
woocommerce/includes/class-wc-download-handler.php 245
do_action( 'woocommerce_download_file_' . $file_download_method, $file_path, $filename );

Где используется хук в WooCommerce

woocommerce/includes/class-wc-download-handler.php 25
add_action( 'woocommerce_download_file_redirect', array( __CLASS__, 'download_file_redirect' ), 10, 2 );
woocommerce/includes/class-wc-download-handler.php 26
add_action( 'woocommerce_download_file_xsendfile', array( __CLASS__, 'download_file_xsendfile' ), 10, 2 );
woocommerce/includes/class-wc-download-handler.php 27
add_action( 'woocommerce_download_file_force', array( __CLASS__, 'download_file_force' ), 10, 2 );