You are here

public function CartManagerInterface::addOrderItem in Commerce Core 8.2

Adds the given order item to the given cart order.

Parameters

\Drupal\commerce_order\Entity\OrderInterface $cart: The cart order.

\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.

bool $combine: Whether the order item should be combined with an existing matching one.

bool $save_cart: Whether the cart should be saved after the operation.

Return value

\Drupal\commerce_order\Entity\OrderItemInterface The saved order item.

1 method overrides CartManagerInterface::addOrderItem()
CartManager::addOrderItem in modules/cart/src/CartManager.php
Adds the given order item to the given cart order.

File

modules/cart/src/CartManagerInterface.php, line 71

Class

CartManagerInterface
Manages the cart order and its order items.

Namespace

Drupal\commerce_cart

Code

public function addOrderItem(OrderInterface $cart, OrderItemInterface $order_item, $combine = TRUE, $save_cart = TRUE);