swarmtix_discounts_update
Changes a discount code, public discount or access code - code, name, reduction, ticket type, window and usage limit
swarmtix_discounts_update
Changes one of an event's discounts and returns it as it stands afterwards. Only the fields you give are changed.
When you would reach for it
- Extending a code that is about to expire.
- Raising the usage limit on a popular code.
- Correcting the percentage before anyone has used the code.
- Renaming a public discount shown on the event page.
Scope
discounts:write
It is idempotent: sending the same arguments twice leaves the same discount, so a client may safely retry.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
event | string | Yes | - | The event's id (a GUID) or its URL slug. |
discount | string | Yes | - | The id of the discount, from swarmtix_discounts_list. |
code | string | No | keeps current | A new code. Not for a public discount. |
name | string | No | keeps current | A new name. Only for a public discount. |
amountOff | number | No | keeps current | A new amount off each ticket. Give this or percentOff. |
percentOff | number | No | keeps current | A new percentage off each ticket, 1 to 100. |
ticketType | string | No | keeps current | The id of the one ticket type it applies to. |
startsAt | string | No | keeps current | "now" or a UTC ISO 8601 instant. |
endsAt | string | No | keeps current | A UTC ISO 8601 instant. |
usesLimit | integer | No | keeps current | The most redemptions in total. 0 removes the limit. |
At least one field must be given. Only an active discount can be changed.
The rules
- A coded discount's name follows its code. A public discount has no code. An access code takes nothing off the price, so it accepts no reduction.
- Once the offer has been redeemed, its code, reduction and ticket type are fixed. You can still change the name, the window and
usesLimit. usesLimitcannot go below the number of redemptions so far. Redemptions are counted per reservation row, the same way checkout counts them.
startsAt and endsAt are read as UTC and stored in the event's local time, using the event's timezone. Set the timezone with swarmtix_events_update first. An event with no timezone is read as UTC.
Example call
{
"name": "swarmtix_discounts_update",
"arguments": {
"event": "spring-summit-2027",
"discount": "a15c9e02-3b7d-4c61-8f95-6d24e0a7b3c8",
"endsAt": "2027-10-15T23:59:00Z",
"usesLimit": 100
}
}What comes back
The discount as stored, in the same shape as swarmtix_discounts_create returns. startDate and endDate are in the event's local time.
Troubleshooting
"code is not valid: it has been redeemed 3 time(s), so its code, reduction and ticket type are fixed."
The discount has been used. You can only change its name, window and usesLimit. To change the price, create a new discount and switch this one off with swarmtix_discounts_delete.
"amountOff is not valid: an access code does not change a price."
Access codes take nothing off. Remove the reduction from the call.
"discount is not valid: there is no active discount with that id on this event."
The id is wrong, belongs to another event, or the discount was switched off. A switched-off discount cannot be changed.
"fields is not valid: no field to change was given."
Add at least one field.
Use cases
- Extending a deadline on a partner code
- Raising the limit on an early-bird code
- Renaming a public discount