public function CartTokenSession::deleteCartId in Commerce Cart API 8
Deletes the given cart order id from the session.
Parameters
int $cart_id: The cart order ID.
string $type: The cart session type.
Overrides CartSessionInterface::deleteCartId
File
- src/
CartTokenSession.php, line 96
Class
- CartTokenSession
- Decorates the cart session to support cart tokens.
Namespace
Drupal\commerce_cart_apiCode
public function deleteCartId($cart_id, $type = self::ACTIVE) {
$this->inner
->deleteCartId($cart_id, $type);
if ($this
->getCurrentRequestCartToken() !== NULL) {
$data = $this
->getTokenCartData();
$ids = $data[$type];
$ids = array_diff($ids, [
$cart_id,
]);
$data[$type] = $ids;
$this
->setTokenCartData($data);
}
}