public function CartSession::addCartId in Commerce Core 8.2
Adds the given cart order ID to the session.
Parameters
int $cart_id: The cart order ID.
string $type: The cart session type.
Overrides CartSessionInterface::addCartId
File
- modules/
cart/ src/ CartSession.php, line 40
Class
- CartSession
- Default implementation of the cart session.
Namespace
Drupal\commerce_cartCode
public function addCartId($cart_id, $type = self::ACTIVE) {
$key = $this
->getSessionKey($type);
$ids = $this->session
->get($key, []);
$ids[] = $cart_id;
$this->session
->set($key, array_unique($ids));
}