Modifying Woo-Commerce Download Handler
Step 1: Sign in to Cpanel and navigate to public_html/wp-content/plugins/woocommerce/includes/class-wc-download-handler.php. Then right on it and press Edit.


Step 2: Copy below code and Paste after line 194 & hit Save Changes
$product = wc_get_product( $product_id );
$drive_filename = $product->get_downloads();
foreach( $drive_filename as $key => $each_download ) {
$filename = $each_download[“name”];
}

Step 3: Paste the Google Drive Share Link on above text field and paste the exact file name with extension in the next text field. (This method works only with .zip formats, So upload every files in zip format)

How to get your sharing URL ->
Step 4: Hit Create Direct Link button on this site. Copy the entire Google Drive Direct Download Link.
If you don't do the Step 2 Woo-Commerce product/s won't download as recognizable files. As mentioned in Step 3 upload all file/s in zip format & paste the exact file name with .zip extension before you hit Create Direct Link button on this site.
IF NOT ZIP FILE, file/s will get download as MP4.
IF ZIP FILE, file/s will get download as zip & works fine. Tested.
When Downloading...
Nice Post! Thank you so much for sharing this wonderful tool to generate google drive direct download link. But you can also do the same using simple tricks mentioned in this blog. Visit Here —> https://bit.ly/35Wx1Vj
Yes! that’s true. That link only shows how to create google drive direct link. Creating google drive direct link is simple. But adding direct links as virtual products in WordPress won’t work correctly. For that you need to do some other steps too. The steps are posted in this page or you can watch the video above. (https://www.youtube.com/watch?v=Q5uqqIymwZE&feature=emb_title)
Hey! Glad you shared this wonderful video on adding direct links as virtual products in WordPress. It works great and Keeps sharing such videos . Keep up the good work…
Thank You.. Yes, we are doing more new things to improve and to improvise our works. Let us know if you need any help with your works. We are here to help you! : )
thank you so much for your solution it is work properly with small files but with large files it is not working , can you find any solution for large files And if there is no solution with Google Drive can you explain any way works with oneDrive cloud because when using OneDrive with woocommerce ,the file downloaded without any extension .
thank you for your support