For the complete documentation index, see llms.txt. This page is also available as Markdown.

Basket Service

A service which handles all things around the basket

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

Every method also has an overload that takes a CancellationToken as its last parameter. Call that one: the overloads without a token are [Obsolete]. See Cancellation Tokens.

Adding throws an ArgumentException (or ArgumentOutOfRangeException) when a line has no currency, when a quantity is outside 1–999,999, when the Basket would hold more than 100 products, or when several lines added together have different currencies. A single line is added to the Basket for its own currency.

If a Saving notification handler cancels a change, the Basket is left as it was.

Get

Gets the Basket

Task<Basket> Get();

Add

Adds an item to the Basket

Parameters:

Name
Detail

item

Item to be added to the Basket

Task<Basket> Add(LineItem item);

Add Multiple

Adds multiple items to the Basket

Parameters:

Name
Detail

items

Items to be added to the Basket

Reduce

Reduces the specified item by a count of 1 or removes from the Basket if only 1

Parameters:

Name
Detail

key

Item to be reduced in the Basket

Remove

Removes the specified item from the Basket

Parameters:

Name
Detail

key

Item to be removed from the Basket

Remove Multiple

Removes multiple items from the Basket

Parameters:

Name
Detail

keys

Items to be removed from the Basket

Clear

Removes all items from the Basket and clears any set Basket cookies

TotalItems

Returns the total quantity of every line in the Basket

SubTotal

Returns the Basket subtotal (minus any shipping or tax)

Last updated