php - Download redirect only in woocommerce -


i customize function handles redirect virtual product purchase page.

this method:

/**  * redirect file start download  * @param  string $file_path  * @param  string $filename  */ public static function download_file_redirect( $file_path, $filename = '' ) {     header( 'location: ' . $file_path );     exit; } 

how can update without modify core class in way?

public static function download_file_redirect( $file_path, $filename = '' ) {     header( 'location: ' . $file_path . '&order=' . $_get['order'] );     exit; } 

updating class works like. not change woocommerce core. there way filter method? not have time modify core each update

hooks available in woocommerce same, hope below code you.

  // define woocommerce_download_product callback      function action_woocommerce_download_product( $download_data_user_email, $download_data_order_key, $download_data_product_id, $download_data_user_id, $download_data_download_id, $download_data_order_id ) {          // make action magic happen here...      };       // add action      add_action( 'woocommerce_download_product', 'action_woocommerce_download_product', 10, 6 );  

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -