Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Fix sold out ticket breaking preventing checkout

Dave Earley99f39648e67b
diff --git a/frontend/src/components/routes/ticket-widget/SelectTickets/index.tsx b/frontend/src/components/routes/ticket-widget/SelectTickets/index.tsx
index 221bffed4..89e9ebbdc 100644
--- a/frontend/src/components/routes/ticket-widget/SelectTickets/index.tsx
+++ b/frontend/src/components/routes/ticket-widget/SelectTickets/index.tsx
@@ -183,6 +183,17 @@ const SelectTickets = (props: SelectTicketsProps) => {
})
});
+ // this is hacky way to add empty quantity for a sold out ticket.
+ // this is needed to avoid validation error when the ticket is sold out.
+ // @todo - refactor this code so returning here doesn't break the checkout process.
+ if (quantitiesValues.length === 0) {
+ quantitiesValues.push({
+ quantity: 0,
+ price_id: 0,
+ price: 0,
+ })
+ }
+
ticketValues.push({
ticket_id: Number(ticket.id),
quantities: quantitiesValues,