public function CartSession::hasCartId in Commerce Core 8.2
Checks whether the given cart order ID exists in the session.
Parameters
int $cart_id: The cart order ID.
string $type: The cart session type.
Return value
bool TRUE if the given cart order ID exists in the session, FALSE otherwise.
Overrides CartSessionInterface::hasCartId
File
- modules/
cart/ src/ CartSession.php, line 50
Class
- CartSession
- Default implementation of the cart session.
Namespace
Drupal\commerce_cartCode
public function hasCartId($cart_id, $type = self::ACTIVE) {
$key = $this
->getSessionKey($type);
$ids = $this->session
->get($key, []);
return in_array($cart_id, $ids);
}