hook_update_n($sandbox) batch getting executed only once Following is the code where I'm willing to update the description of the field_meta_tags of all my products using the batch process.

It's getting executed &amp; working as expected, but only for the first batch.

function mymodule_update_8001($sandbox) {
  if (!isset($sandbox['total'])) {
    $products = \Drupal::entityQuery('commerce_product')
      -&gt;condition('type', 'default')
      -&gt;execute();
    $sandbox['total'] = count($products);
    $sandbox['current'] = 0;
  }

  $products_per_batch = 25;

  $products = \Drupal::entityQuery('commerce_product')
    -&gt;condition('type', 'default')
    -&gt;range($sandbox['current'], $sandbox['current'] + $products_per_batch)
    -&gt;execute();

  foreach ($products as $product_id) {
    $product = Drupal\commerce_product\Entity\Product::load($product_id);
    $product-&gt;set('field_meta_tags', serialize(['description' =&gt; '']));
    $product-&gt;save();
    $sandbox['current']++;
  }

  \Drupal::messenger()
    -&gt;addMessage($sandbox['current'] . ' products processed.');

  $sandbox['#finished'] = empty($sandbox['total']) ? 1 : ($sandbox['current'] / $sandbox['total']);
}


Once the above hook_update_n($sandbox) is executed, getting the following output at the terminal:

 --------------- ----------- --------------- ------------- 
  Module          Update ID   Type            Description  
 --------------- ----------- --------------- ------------- 
  mymodule        8001        hook_update_n   Updates.     
 --------------- ----------- --------------- ------------- 

 // Do you wish to run the specified pending updates?: yes.                                                             

&gt;  [notice] Update started: mymodule_update_8001
&gt;  [notice] Update completed: mymodule_update_8001
&gt;  [notice] Message: 25 products processed.
&gt; 
 [success] Finished performing updates.


Not sure how $sandbox['#finished'] is getting the value as 1, since that's how I remember we ask the batch to stop processing.
There is no need for batches if you intend to run all entries in one process. 

This is something we had use to update around 30.000 entries i quickly adapted from your example :

/**
 * Query all commerce_product of type default
 *
 * *
 * @param array $sandbox
 *
 * @return string
 *  Number of updated rows
 */
function mymodule_post_update_0801(array $sandbox) {
  /** @var $connection Drupal\Core\Database\Connection */
  $connection = \Drupal::service('database');
  $query = $connection-&gt;select('commerce_product', 'p');
  $query-&gt;fields('p', ['id'])
    -&gt;condition('type', 'default');
  $toUpdate = $query-&gt;execute()-&gt;fetchAll();

  $result = array_map( 'update_description_value', $toUpdate);

  return sprintf('Number of row updated: %s', count($result));
}

/**
 * Update a product description
 *
 * @param stdClass $defaultProduct
 *  -&gt;id
 *
 * @return string
 *  product id
 */
function update_description_value($productQueried) {
  /** @var $connection Drupal\Core\Database\Connection */
  $connection = \Drupal::service('database');

  $updated = $connection-&gt;update('commerce_product')
    -&gt;fields(['field_meta_tags' =&gt; serialize(['description' =&gt; ''])])
    -&gt;condition('id', $productQueried-&gt;id, '=')
    -&gt;execute();

  return $productQueried-&gt;id;
}


Let me know if there is typo somewhere.