interface CartManagerInterface in Commerce Core 8.2
Manages the cart order and its order items.
Hierarchy
- interface \Drupal\commerce_cart\CartManagerInterface
Expanded class hierarchy of CartManagerInterface
All classes that implement CartManagerInterface
4 files declare their use of CartManagerInterface
- AddToCartForm.php in modules/
cart/ src/ Form/ AddToCartForm.php - EditQuantity.php in modules/
cart/ src/ Plugin/ views/ field/ EditQuantity.php - EmptyCartButton.php in modules/
cart/ src/ Plugin/ views/ area/ EmptyCartButton.php - RemoveButton.php in modules/
cart/ src/ Plugin/ views/ field/ RemoveButton.php
File
- modules/
cart/ src/ CartManagerInterface.php, line 12
Namespace
Drupal\commerce_cartView source
interface CartManagerInterface {
/**
* Empties the given cart order.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $cart
* The cart order.
* @param bool $save_cart
* Whether the cart should be saved after the operation.
*/
public function emptyCart(OrderInterface $cart, $save_cart = TRUE);
/**
* Adds the given purchasable entity to the given cart order.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $cart
* The cart order.
* @param \Drupal\commerce\PurchasableEntityInterface $entity
* The purchasable entity.
* @param string $quantity
* The quantity.
* @param bool $combine
* Whether the order item should be combined with an existing matching one.
* @param bool $save_cart
* Whether the cart should be saved after the operation.
*
* @return \Drupal\commerce_order\Entity\OrderItemInterface
* The saved order item.
*/
public function addEntity(OrderInterface $cart, PurchasableEntityInterface $entity, $quantity = '1', $combine = TRUE, $save_cart = TRUE);
/**
* Creates an order item for the given purchasable entity.
*
* @param \Drupal\commerce\PurchasableEntityInterface $entity
* The purchasable entity.
* @param string $quantity
* The quantity.
*
* @return \Drupal\commerce_order\Entity\OrderItemInterface
* The created order item. Unsaved.
*/
public function createOrderItem(PurchasableEntityInterface $entity, $quantity = '1');
/**
* Adds the given order item to the given cart order.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $cart
* The cart order.
* @param \Drupal\commerce_order\Entity\OrderItemInterface $order_item
* The order item.
* @param bool $combine
* Whether the order item should be combined with an existing matching one.
* @param bool $save_cart
* Whether the cart should be saved after the operation.
*
* @return \Drupal\commerce_order\Entity\OrderItemInterface
* The saved order item.
*/
public function addOrderItem(OrderInterface $cart, OrderItemInterface $order_item, $combine = TRUE, $save_cart = TRUE);
/**
* Updates the given order item.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $cart
* The cart order.
* @param \Drupal\commerce_order\Entity\OrderItemInterface $order_item
* The order item.
* @param bool $save_cart
* Whether the cart should be saved after the operation.
*/
public function updateOrderItem(OrderInterface $cart, OrderItemInterface $order_item, $save_cart = TRUE);
/**
* Removes the given order item from the cart order.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $cart
* The cart order.
* @param \Drupal\commerce_order\Entity\OrderItemInterface $order_item
* The order item.
* @param bool $save_cart
* Whether the cart should be saved after the operation.
*/
public function removeOrderItem(OrderInterface $cart, OrderItemInterface $order_item, $save_cart = TRUE);
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CartManagerInterface:: |
public | function | Adds the given purchasable entity to the given cart order. | 1 |
CartManagerInterface:: |
public | function | Adds the given order item to the given cart order. | 1 |
CartManagerInterface:: |
public | function | Creates an order item for the given purchasable entity. | 1 |
CartManagerInterface:: |
public | function | Empties the given cart order. | 1 |
CartManagerInterface:: |
public | function | Removes the given order item from the cart order. | 1 |
CartManagerInterface:: |
public | function | Updates the given order item. | 1 |