仅在woocommerce中下载重定向

I would like to customize the function that handles the redirect to the virtual product purchase page.

This is the method:

/**
 * Redirect to a file to start the download
 * @param  string $file_path
 * @param  string $filename
 */
public static function download_file_redirect( $file_path, $filename = '' ) {
    header( 'Location: ' . $file_path );
    exit;
}

How can I update this without modify the core class in this way?

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

Updating the class works as I would like. But I will not change the woocommerce core. Is there a way to filter this method? So you do not have any time to modify the core with each update

Hooks are available in woocommerce for same, I hope below code will help you.

  // define the 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 the action 
    add_action( 'woocommerce_download_product', 'action_woocommerce_download_product', 10, 6 );