I found a temporary solution.
In the file: includes/class-wc-download-handler.php
At line 195 : $filename = current (explode (‘?’, $filename));
That’s what’s causing the problem because with Google Drive the name of the file is not transmitted in the url. So I try to recover this file name using curl but I didn’t succeed…
So, when you create your product and add a file to download, you must fill the name of your file and your url. So I use the name field to name my file (same name as my file stored in my Google Drive with extension).
Then, I made changes at line 194 :
if ( strstr( $filename, ‘?’ ) ) {
$filename = current( explode( ‘?’, $filename ) );
}
In :
if ( strstr( $filename, ‘?’ ) ) {
$filename = current( explode( ‘?’, $filename ) );
$product = wc_get_product( $product_id );
$drive_filename = $product->get_downloads();
foreach( $drive_filename as $key => $each_download ) {
$filename = $each_download[“name”];
}
}
It works for the moment ??