Guides / Delete a product catalog
How to delete a Chargebee product catalog
Last updated
Test sites collect plans like "pro-plan-v2-final" and "addon-old-do-not-use". Here's how to clear them out and start from an empty catalog.
How the catalog is built
In Chargebee's Product Catalog 2.0 there are three record types you need to remove:
- Items: your plans, add-ons and charges.
- Item prices: the prices for each item, for example monthly in EUR or yearly in USD.
- Price variants: optional variants used to group prices.
Item prices belong to items. That's why the order matters.
The right order
- Delete all item prices.
- Delete all items.
- Delete all price variants.
If you start with items, Chargebee will refuse to delete the ones that still have prices.
The manual way
In the Chargebee UI
Open each price and delete it, then each item, then each price variant. That's fine for five records and painful for fifty.
With the API
List every record of each type and delete them one by one, in the order above:
GET /api/v2/item_prices, thenDELETEeach oneGET /api/v2/items, thenDELETEeach oneGET /api/v2/price_variants, thenDELETEeach one
Remember that list calls are paginated, so loop until there's no next page. Some records may still fail to delete, for example if they're in use. Log those so you can deal with them separately.
Be careful: run this only on a test site. Double-check the site name in your API base URL before you start.
The one-click way with Testabee
Testabee's catalog reset first shows how many item prices, items and price variants are on the site. You confirm by typing the site name, and it deletes them in the right order while you watch the progress. Anything that can't be deleted is listed with Chargebee's error message.
It only runs on test sites. To get your catalog back afterwards, save it as a template first and restore it in one click, or use the full reset, which does both.