# Basket Service

The basket service is what and handles all the UmbCheckout Basket operations.

You can access the basket service by injecting `IBasketService` which can be found within the namespace`UmbCheckout.Core.Interfaces`

#### Get

Gets the [Basket](/core-services/object-reference/basket.md)

```csharp
Task<Basket> Get();
```

#### Add

Adds an item to the [Basket](/core-services/object-reference/basket.md)

Parameters:

| Name | Detail                                                                        |
| ---- | ----------------------------------------------------------------------------- |
| item | [Item](/core-services/object-reference/lineitem.md) to be added to the Basket |

```csharp
Task<Basket> Add(LineItem item);
```

#### Add Multiple

Adds multiple items to the [Basket](/core-services/object-reference/basket.md)

Parameters:

| Name  | Detail                                                                         |
| ----- | ------------------------------------------------------------------------------ |
| items | [Items](/core-services/object-reference/lineitem.md) to be added to the Basket |

```csharp
Task<Basket> Add(IEnumerable<LineItem> items);
```

#### Reduce

Reduces the specified item by a count of 1 or removes from the [Basket](/core-services/object-reference/basket.md) if only 1

Parameters:

| Name | Detail                                                                          |
| ---- | ------------------------------------------------------------------------------- |
| key  | [Item](/core-services/object-reference/lineitem.md) to be reduced in the Basket |

```csharp
Task<Basket> Reduce(Guid id);
```

#### Remove

Removes the specified item from the [Basket](/core-services/object-reference/basket.md)

Parameters:

| Name | Detail                                                                            |
| ---- | --------------------------------------------------------------------------------- |
| key  | [Item](/core-services/object-reference/lineitem.md) to be removed from the Basket |

```csharp
Task<Basket> Remove(Guid id);
```

#### Remove Multiple

Removes multiple items from the [Basket](/core-services/object-reference/basket.md)

Parameters:

| Name | Detail                                                                             |
| ---- | ---------------------------------------------------------------------------------- |
| keys | [Items](/core-services/object-reference/lineitem.md) to be removed from the Basket |

```csharp
Task<Basket> Remove(IEnumerable<Guid> ids);
```

#### Clear

Removes all items from the Basket and clears any set [Basket](/core-services/object-reference/basket.md) cookies

```csharp
Task<Basket> Clear();
```

#### TotalItems

Returns the total item quantity count

```csharp
Task<long> TotalItems();
```

#### SubTotal

Returns the [Basket](/core-services/object-reference/basket.md) subtotal (minus any shipping or tax)

```csharp
Task<decimal> SubTotal();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.umbcheckout.net/core-services/basket-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
