swarmtix_ticket_types_delete
Permanently deletes a ticket type that nobody has ordered, on an unpublished event
swarmtix_ticket_types_delete
Permanently deletes a ticket type that nobody has ordered, and returns the ticket types that remain, in order. This cannot be undone.
When you would reach for it
- Removing a tier you added by mistake while building a draft.
- Cleaning up a duplicate after a retried
swarmtix_ticket_types_create.
Scope
events:write
This tool is marked destructive and is not idempotent. A second call for the same ticket type finds nothing to delete and is refused. There is no undo.
When it is refused
It refuses, and changes nothing, in these cases:
| Case | Why |
|---|---|
| The event is published | Only a published event sells. A ticket type could be bought while it is being deleted. Unpublish the event in the dashboard first. |
| Any order has a ticket of this type, even a cancelled one | A deleted ticket type with order history leaves a hole in somebody's records. |
| A checkout reservation holds one | A buyer is in the middle of checking out. |
| An active discount or access code points at it | Remove or switch those off first. |
| An active checkout question is attached to it | Switch the question off first. |
Deleting the last ticket type leaves the event with nothing to sell. To change a ticket type that has sold, use swarmtix_ticket_types_update instead.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
event | string | Yes | - | The event's id (a GUID) or its URL slug. |
ticketType | string | Yes | - | The id of the ticket type to delete, from swarmtix_ticket_types_list. |
Example call
{
"name": "swarmtix_ticket_types_delete",
"arguments": {
"event": "spring-summit-2027",
"ticketType": "b7d3e5a1-92c4-4f18-8a6b-3e0f1c7d9a52"
}
}What comes back
{
"deleted": "b7d3e5a1-92c4-4f18-8a6b-3e0f1c7d9a52",
"ticketTypes": [
{ "id": "5e0a9c42-1f6d-4d0b-b7a3-2c8e41f7d6a9", "name": "General Admission", "price": 59, "quantity": 300 }
]
}deleted is the id that was removed. ticketTypes is every active ticket type left, in order, in the same shape as swarmtix_ticket_types_create returns.
What happens when you call it
- The event is resolved through the edit gate, and the ticket type must belong to that event.
- The event must be unpublished.
- The order, reservation, discount and question checks above run.
- The ticket type is deleted.
- The row is looked up again. If it is still there, the call fails.
The checks and the delete are not one transaction. In theory an event could be published and an order completed in the gap between them. The window is very small.
Troubleshooting
"event is not valid: it is published, and a ticket type could be bought while it is deleted."
Unpublish the event in the dashboard, then try again.
"ticketType is not valid: tickets of this type have been ordered, even if the orders were cancelled."
It has order history and cannot be deleted. Use swarmtix_ticket_types_update to change it, or leave it.
"ticketType is not valid: an active discount or access code is attached to it."
Switch it off with swarmtix_discounts_delete first. The same applies to an attached checkout question: use swarmtix_checkout_questions_delete.
"ticketType is not valid: there is no ticket type with that id on this event."
The id is wrong, or belongs to another event. List the ticket types to check.
Use cases
- Removing a mistaken tier from a draft
- Cleaning up after a retried create