The Problem
This feature of automatically updating orders previously made with new downloadable files added to the product in WooCommerce was removed in 2.7x. It has caused me an incredible amount of pain.
Edit your `functions.php` and insert the following code.
The Solution
-- CODE language-php --
add_filter('bulk_actions-edit-shop_order', 'register_my_bulk_actions');
function register_my_bulk_actions($bulk_actions) {
$bulk_actions['regenerate_downloads'] = 'Regenerate download permissions';
return $bulk_actions;
}
add_filter('handle_bulk_actions-edit-shop_order', 'my_bulk_action_handler', 10, 3);
function my_bulk_action_handler($redirect_to, $doaction, $post_ids) {
if ($doaction == 'regenerate_downloads') {
foreach ($post_ids as $post_id) {
wc_downloadable_product_permissions($post_id, false);
}
$redirect_to = add_query_arg('regenerated_downloads', count($post_ids), $redirect_to);
}
return $redirect_to;
}
add_action('admin_notices', 'my_bulk_action_admin_notice');
function my_bulk_action_admin_notice() {
if (!empty($_REQUEST['regenerated_downloads'])) {
$count = intval($_REQUEST['regenerated_downloads']);
}
}
There should now be a bulk action in your WooCommerce orders page. Select the orders that you want to update Download Permissions for and go to Bulk Actions > Regenerate download permissions