---
title: "deleteItems"
slug: "api/basket/operations/deleteitems"
sidebar:
  order: 434
---

<a id="ref-46adf82033af"></a>
<a id="ref-8d7d211191cf"></a>
<a id="ref-13be3797e0d3"></a>

## Synopsis

```text
void deleteItems(SessionId sessionId,
    BItemId[]          itemIds,
    DeleteItemsOptions options)
throws BasketServiceFault;
```

See also: [SessionId](/pCon/configuratorOnline/specs/api/session/types/sessionid#ref-02e397c8fdb4), [BItemId](/pCon/configuratorOnline/specs/api/basket/types/bitemid#ref-bccb6c926e5b), [DeleteItemsOptions](/pCon/configuratorOnline/specs/api/basket/types/deleteitemsoptions#ref-7fc0e9b549dd), [BasketServiceFault](/pCon/configuratorOnline/specs/api/basket/faults/basketservicefault#ref-d5adb74faa1b)

The `deleteItems` operation deletes the basket items identified by the elements of the `itemIds` sequence parameter from the basket item tree maintained by the basket service for the session identified by the `sessionId` parameter.

The options inherited from [`ItemSelectionOptions`](/pCon/configuratorOnline/specs/api/basket/types/itemselectionoptions) are handled in the usual manner. The option `subArticles` defined for [`DeleteItemsOptions`](/pCon/configuratorOnline/specs/api/basket/types/deleteitemsoptions) enables (if specified as `true`) the deletion of individual sub-articles of composite articles.

All elements of the `itemIds` sequence parameter must identify existing basket items. If at least one item ID does not identify an existing item then no items will be deleted.

Duplicate item IDs are considered only once.

The root of the basket item tree cannot be deleted. If specified, it will be silently ignored.

It is not an error if the `itemIds` parameter is an empty sequence.

If one of the identified basket items has independent child items[^1] which are not selected for deletion and `DeletionItemsOptions` is specified as `false`, they will not be deleted. Instead, they will replace their deleted parent. The order of remaining basket items, as determined by tree-traversal after deletion, will be identical to the relative order of the same items prior to deletion.

If an item to be deleted is the main article item of a compound article, all items that belong to the compound article are deleted, and independent child items of all deleted items are handled as described above.

If an item to be deleted is a sub-article item of a compound article, the operation silently ignores this item.

A [`BasketServiceFault`](/pCon/configuratorOnline/specs/api/basket/faults/basketservicefault) is returned if any of the following conditions occurs:

- The `sessionId` parameter is not a valid string representation of an UUID or does not represent an open session.

- At least one of the elements of the `itemIds` sequence parameter is not a valid string representation of an UUID.

- At least one of the elements of the `itemIds` sequence parameter does not identify an existing basket item.

[^1]: The Online Configurator supports ‘compound articles’ that consist of more than one individual basket article item, one of them being the ‘main article item’. If the main article item of such a compound article gets deleted, all other items belonging to the compound article (whether or not they are children of the main item) will be deleted too.
