Price resolver save custom field I would like to update a custom field, added to my order items, in the price resolver process. The price resolver process do some sort of queries to select the right price and this selection has a key that I want to save in the custom field.
I'm not sure how could I alter the order line item after the right price was selected.
You price resolver should have something like
if (isset($result['price'])) {
    return new Price((string) $result['price'], $context-&gt;getStore()-&gt;getDefaultCurrencyCode());
}

Before your price resolver's return line put:
$cart_provider = \Drupal::service('commerce_cart.cart_provider');
$cart = $cart_provider-&gt;getCart('default');
$order_items = $cart-&gt;order_items-&gt;referencedEntities();
foreach ($order_items as $order_item) { 
  if (!empty($order_item-&gt;field_custom)) {
    $order_item-&gt;field_custom-&gt;value = 'Hello World'; // set new value
    $cart_manager = \Drupal::service('commerce_cart.cart_manager');
    $cart_manager-&gt;updateOrderItem($cart, $order_item);
  }
}