Delete a Category Sitecore Item

Current version: 8.2

The new Sitecore Item extensions method DeleteAsCatalogItem lets you specifically delete Sitecore Items.

Using the regular Delete method on a Sitecore Item to delete a Sitecore Item that represents category is not the most efficient use of resources. The regular Delete method will recurse down to the leaf nodes of a category and delete upwards, which may result in the unplanned deletion of other things.

The new Sitecore Item extensions method, DeleteAsCatalogItem, is under the Sitecore.Commerce.Connect.CommerceServer.Extensions.CatalogExtensions namespace. This method deletes via the DeleteCatalogOrCategoryItem pipeline, which is able to recognize the type of the Sitecore Item, only the Category Item, and not all of the children beneath it.

Do you have some feedback for us?

If you have suggestions for improving this article,