public static function process_product_file_download_paths($product_id, $variation_id, $downloads)
{
if ($variation_id) {
$product_id = $variation_id;
}
$product = wc_get_product($product_id);
$data_store = WC_Data_Store::load('customer-download');
if ($downloads) {
foreach ($downloads as $download) {
$new_hash = md5($download->get_file());
if ($download->get_previous_hash() && $download->get_previous_hash() !== $new_hash) {
// Update permissions.
$data_store->update_download_id($product_id, $download->get_previous_hash(), $new_hash);
}
}
}
}