---
title: ICookieManager
slug: configured-commerce/docs/icookiemanager
docTags: 
createdAt: 2026-08-13T10:46:28.000Z
---

## Description

This is a wrapper class that allows you to more easily manipulate HTTP cookies on the server.

## Methods

### Get(string)

Returns the value of a cookie in the HTTP request.

```csharp
string Get(string name)
```

**Parameters**

- **name** – The name of the cookie for which to search.

**Returns**

If the cookie is found, this returns the value of the cookie.

### Add(string, string, DateTimeOffset)

Adds a cookie to the HTTP response and sets the expiration date and time.

```csharp
void Add(string name, string value, DateTimeOffset? expires = null)
```

**Parameters**

- **name** – The name of the cookie to add.
- **value** – The value to store inside the cookie.
- **expires** – The date and time that the cookie should expire.

### Remove(string)

Removes a cookie from the HTTP request. Also, adds an expired cookie of the same name to the HTTP response.

```csharp
void Remove(string name)
```

**Parameters**

- **name** – The name of the cookie to remove.

## Example

The example below is an excerpt from the CartOrderProviderByUser. For non-authenticated users, the cart is stored in a cookie. The example attempts to retrieve the customerOrderId from the cookie in order to retrieve the cart for the user.

```csharp
protected virtual CustomerOrder GetCustomerOrderForNotLoggedUser()
    {
        var customerOrderId = this.CookieManager.Get(this.CartCookieName);
        return customerOrderId.IsBlank()
            ? null
            : this.UnitOfWork.GetRepository<CustomerOrder>().Get(customerOrderId);
    }
```
