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 namespaceUmbCheckout.Core.Interfaces
Gets the Basket
Task<Basket> Get();Adds an item to the Basket
Parameters:
| Name | Detail |
|---|---|
| item | Item to be added to the Basket |
Task<Basket> Add(LineItem item);Add Multiple
Section titled “Add Multiple”Adds multiple items to the Basket
Parameters:
| Name | Detail |
|---|---|
| items | Items to be added to the Basket |
Task<Basket> Add(IEnumerable<LineItem> items);Reduce
Section titled “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 |
Task<Basket> Reduce(Guid id);Remove
Section titled “Remove”Removes the specified item from the Basket
Parameters:
| Name | Detail |
|---|---|
| key | Item to be removed from the Basket |
Task<Basket> Remove(Guid id);Remove Multiple
Section titled “Remove Multiple”Removes multiple items from the Basket
Parameters:
| Name | Detail |
|---|---|
| keys | Items to be removed from the Basket |
Task<Basket> Remove(IEnumerable<Guid> ids);Removes all items from the Basket and clears any set Basket cookies
Task<Basket> Clear();TotalItems
Section titled “TotalItems”Returns the total item quantity count
Task<long> TotalItems();SubTotal
Section titled “SubTotal”Returns the Basket subtotal (minus any shipping or tax)
Task<decimal> SubTotal();