public function CartManagerInterface::addEntity in Commerce Core 8.2
Adds the given purchasable entity to the given cart order.
Parameters
\Drupal\commerce_order\Entity\OrderInterface $cart: The cart order.
\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.
string $quantity: The quantity.
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::addEntity()
- CartManager::addEntity in modules/
cart/ src/ CartManager.php - Adds the given purchasable entity to the given cart order.
File
- modules/
cart/ src/ CartManagerInterface.php, line 41
Class
- CartManagerInterface
- Manages the cart order and its order items.
Namespace
Drupal\commerce_cartCode
public function addEntity(OrderInterface $cart, PurchasableEntityInterface $entity, $quantity = '1', $combine = TRUE, $save_cart = TRUE);