You are here

public function Order::hasItem in Commerce Core 8.2

Checks whether the order has a given order item.

Parameters

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

Return value

bool TRUE if the order item was found, FALSE otherwise.

Overrides OrderInterface::hasItem

1 call to Order::hasItem()
Order::addItem in modules/order/src/Entity/Order.php
Adds an order item.

File

modules/order/src/Entity/Order.php, line 305

Class

Order
Defines the order entity class.

Namespace

Drupal\commerce_order\Entity

Code

public function hasItem(OrderItemInterface $order_item) {
  return $this
    ->getItemIndex($order_item) !== FALSE;
}