"Order items" view displaying removed items (variations)? I'm dynamically removing items from cart with this function:
  static function _remove_product_variation_from_cart($variationId) {
    $orders = \Drupal::service('commerce_cart.cart_provider')-&gt;getCarts();
    if (empty($orders)) {
      return 0;
    }
    $items = reset($orders)-&gt;getItems();

    foreach ($items as $item) {
      $quantity = $item-&gt;getQuantity();
      $itemVariationId = $item-&gt;getPurchasedEntity()-&gt;id();
      if ($variationId == $itemVariationId){
        foreach ($orders as $order) {
          $order-&gt;removeItem($item)-&gt;save();
        }
        return $quantity;
      }
    }
    return 0;
  }

And during checkout process it's all fine - removed items are not displayed. But page:
/user/user_id/orders/order_id

is listing also removed items (that's view &quot;Order items&quot;). Sum (order total) is correct however.
On other hand i.e. view &quot;Checkout Order Summary&quot; is returning order items correctly (without removed ones).
Am I removing cart item wrong way or something? Why is this happening?
foreach ($items as $item) {
  $quantity = $item-&gt;getQuantity();
  $itemVariationId = $item-&gt;getPurchasedEntity()-&gt;id();
  if ($variationId == $itemVariationId){
    foreach ($orders as $order) {
      $cart_manager = \Drupal::service('commerce_cart.cart_manager');
      $cart_manager-&gt;removeOrderItem($order, $item);
    }
    return $quantity;
  }
}
// return 0; &lt;-- not necessary, functions don't have to always return.