> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Custom Ticket Booking Page

## Article: Custom Ticket Booking Page

## Article Link: https://dev.wix.com/docs/coding-examples/business-solutions/wix-events/custom-ticket-booking-page.md

## Article Content:

# Custom Ticket Booking Page

Create a custom page where visitors can book multiple kinds of tickets for an event.

<div style="display: flex; flex-direction: row; align-items: center;"> 
<span style="display: flex; flex-direction: row; align-items: center; margin-right: 20px;"> 
<img src="https://wixmp-833713b177cebf373f611808.wixmp.com/images/b63c1547ac02ae3e117d666c004b4e11.png" style="width: 15px; height: 15px;"> 
<span style="margin-left:3px; color:rgb(51 56 83); font-size:1rem">Advanced</span> 
</span> 
<span style="color:rgb(51 56 83); font-size:1rem">Last updated: 27 Aug 2025</span> 
</div> 
<div style="display: flex; flex-direction: column; padding-top: 20px; padding-bottom: 20px;">
<div style="width: 100%; margin-bottom: 20px;"> 
<img src="https://static.wixstatic.com/media/a6d987_393cb1d62464402f920ae8e454c95d2e~mv2.webp" alt="Custom Ticket Booking Page" style="width: 100%;"> 
</div> 
<div style="display: flex; flex-direction: row; justify-content: space-between; align-items: center; width: 100%;">
<div style="margin: 0px 20px 20px 0px;">
<a href="fallback::https://manage.wix.com/edit-template/from?originTemplateId=91e7ad64-cfbe-499b-91e1-8c5248d13631&templateId=c4032268-e5af-4e75-a305-50ccb7185baf&autoDevMode=true" target="_blank"> <button style="margin-right: 10px;background-color:#106DFF; color:white; padding:10px 20px; border:none; border-radius:21px; cursor:pointer; margin: 0px 20px 20px 0px;" target="_blank">Open Example</button></a> 
<a href="fallback::https://www.wix.com/velo-examples/custom-event-ex" target="_blank"><button style="background-color:white; color:#106DFF; padding:10px 20px; border:1px solid #106DFF; border-radius:21px; cursor:pointer; width:125px;" target="_blank">Preview</button></a> 
</div> 
</div> 
</div> 
</div>

## About
---

In this example, we build a page that allows visitors to purchase different quantities of 2 distinct types of event tickets.

## Before you begin
---
To use this example:
* You must install Wix Events & Tickets on your site.
* Your site must have an event with at least 2 types of tickets.

## APIs 
---
<ul> 
<li><a href="portalId::f356b938-ca2c-46f4-a390-e7ed146e00e0resourceId::4226f67a-73d7-47fd-acd0-e8e474f9f390slug::repeater/introduction*fallback::https://dev.wix.com/docs/velo/api-reference/$w/repeater/introduction".md target="_blank">$w.Repeater API</a></li> 
<li><a href="fallback::https://dev.wix.com/docs/sdk/frontend-modules/events/tickets/introduction".md target="_blank">Events - Tickets </a></li> 
<li><a href="portalId::b85dea5b-341b-493b-b99e-4d4ca12baaa2resourceId::e8ae0bc0-16dc-4f95-b66e-c64d2998fcf7slug::aggregate-data-items*fallback::https://dev.wix.com/docs/sdk/backend-modules/data/items/introduction".md target="_blank">Data - Items </a></li> 
<li><a href="fallback::https://dev.wix.com/docs/sdk/frontend-modules/location/introduction".md target="_blank">Location </a></li> 
</ul> 

## How we built it 
---
We added the following to our site:

#### Page Elements

*   A [repeater](https://dev.wix.com/docs/velo/velo-only-apis/$w/repeater/introduction.md) to display the types of tickets. Repeater items contain:
	* [Text](https://dev.wix.com/docs/velo/velo-only-apis/$w/text/introduction.md) elements to display details about the ticket.
	* A [dropdown](https://dev.wix.com/docs/velo/velo-only-apis/$w/dropdown/introduction.md) to choose the amount of tickets to buy.
*   A [button](https://dev.wix.com/docs/velo/velo-only-apis/$w/button/introduction.md) to reserve tickets and then proceed to the payment page.

#### Frontend Code 

##### Home
    
The code in this file sets up the repeater to display the different ticket types for the event, and allows visitors to buy varying amounts of each ticket by clicking the button. 

In this file, we: 

*   Configure the repeater items to reflect the various tickets in the Events/Tickets collection.
*   Add an onClick() event handler to the Buy Tickets button. The handler calls reserveTickets() from reserveTickets.js to reserve the tickets and navigate the visitor to a payment form.

#### Public Code

##### reserveTickets.js

The code in this file manages the ticket reservation process for the event. The code retrieves the correct event, collects the selected ticket types and quantities, reserves the tickets, and then navigates the visitor to a payment form.

We defined the following methods:

*   getEventId(): Finds the event in the Events/Events collection by title, and returns the event’s id.
*   getSelectedTickets(): Reads the visitor’s ticket selections from the page and returns a list of objects representing ticket types where the visitor chose an amount. Each object has the following fields:
	* ticketId: The unique ID of the ticket type selected.
	* quantity: The number of tickets the visitor chose for that type.
*   reserveTickets(): Exported method. Uses getEventId() and getSelectedTickets() to reserve the visitor’s selected tickets for the event, and then redirects to a payment form page upon success, or logs an error if the reservation fails.

## Code Snippets
---
<details open> 
<summary> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 18" width="22" height="22">
    <path d="M16.003 15.18c0 .57-.11 1.01-.31 1.32.2.31.31.75.31 1.32 0 .94.33 1.22.53 1.24.27.02.481.25.471.52-.01.27-.22.48-.49.48-.521 0-1.512-.47-1.512-2.24 0-.51-.1-.74-.16-.81h-.06c-.06 0-.11 0-.16-.01a.505.505 0 0 1-.561-.29.522.522 0 0 1-.04-.21c0-.08 0-.17.04-.25.1-.22.35-.32.58-.27h.2c.06-.06.17-.29.17-.81 0-1.77.992-2.24 1.513-2.24.28 0 .5.22.5.5s-.22.5-.5.5c-.18.02-.511.3-.511 1.24l-.01.01Zm5.967 1.1c-.09-.22-.33-.33-.57-.28h-.211c-.06-.06-.17-.29-.17-.81 0-1.77-.991-2.24-1.512-2.24-.27 0-.48.21-.49.48-.01.27.2.5.47.52.2.02.53.3.53 1.24 0 .57.11 1.01.311 1.32-.2.31-.31.75-.31 1.32 0 .94-.33 1.22-.511 1.24-.28 0-.5.22-.5.5s.22.5.5.5c.52 0 1.512-.47 1.512-2.24 0-.51.1-.74.16-.81h.06c.06 0 .11 0 .15-.01.23.06.47-.05.57-.27.041-.08.041-.17.041-.25 0-.07 0-.14-.04-.21h.01ZM17.014 4H6.001C5.451 4 5 4.45 5 5v14c0 .55.45 1 1.001 1h7.008v-1H6.001V5h11.013v6h1.001V5c0-.55-.45-1-1-1Zm-9.01 7h7.008v-1H8.004v1Zm7.008-4H8.004v1h7.008V7Z"></path>
  </svg> undefined </summary> 

```javascript
import wixEventsFrontend from '@wix/site-events';
import { items } from "@wix/data";
import { location } from '@wix/site-location';

const EVENT_TITLE = "Apex Festival"

async function getEventId() {
    const eventResults = await items.query("Events/Events")
        .eq("title", EVENT_TITLE)
        .find();

    if (eventResults.items.length > 0) {
        const eventId = eventResults.items[0]._id;
        return eventId;
    } else {
        console.error("Could not find event");
    }
}

function getSelectedTickets() {
    const selectedTickets = [];
    $w("#ticketsRepeater").forEachItem(($item, ticket) => {
        const ticketQty = Number($item("#ticketQuantity").value);
        if (ticketQty > 0) {
            selectedTickets.push({
                "ticketId": ticket._id,
                "quantity": ticketQty
            });
        }
    });
    return selectedTickets;
}


export async function reserveTickets() {
    const eventId = await getEventId();
    let selectedTickets = getSelectedTickets();
    wixEventsFrontend.tickets.reserve(eventId, selectedTickets)
        .then((reservation) => {
            location.to(`/event-details/apex-festival/ticket-form?reservationId=${reservation.id}`);
        })
        .catch((error) => {
            console.log("Error", error.message)
        });
}
```
</details>

<details open> 
<summary> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 18" width="22" height="22">
    <path d="M16.003 15.18c0 .57-.11 1.01-.31 1.32.2.31.31.75.31 1.32 0 .94.33 1.22.53 1.24.27.02.481.25.471.52-.01.27-.22.48-.49.48-.521 0-1.512-.47-1.512-2.24 0-.51-.1-.74-.16-.81h-.06c-.06 0-.11 0-.16-.01a.505.505 0 0 1-.561-.29.522.522 0 0 1-.04-.21c0-.08 0-.17.04-.25.1-.22.35-.32.58-.27h.2c.06-.06.17-.29.17-.81 0-1.77.992-2.24 1.513-2.24.28 0 .5.22.5.5s-.22.5-.5.5c-.18.02-.511.3-.511 1.24l-.01.01Zm5.967 1.1c-.09-.22-.33-.33-.57-.28h-.211c-.06-.06-.17-.29-.17-.81 0-1.77-.991-2.24-1.512-2.24-.27 0-.48.21-.49.48-.01.27.2.5.47.52.2.02.53.3.53 1.24 0 .57.11 1.01.311 1.32-.2.31-.31.75-.31 1.32 0 .94-.33 1.22-.511 1.24-.28 0-.5.22-.5.5s.22.5.5.5c.52 0 1.512-.47 1.512-2.24 0-.51.1-.74.16-.81h.06c.06 0 .11 0 .15-.01.23.06.47-.05.57-.27.041-.08.041-.17.041-.25 0-.07 0-.14-.04-.21h.01ZM17.014 4H6.001C5.451 4 5 4.45 5 5v14c0 .55.45 1 1.001 1h7.008v-1H6.001V5h11.013v6h1.001V5c0-.55-.45-1-1-1Zm-9.01 7h7.008v-1H8.004v1Zm7.008-4H8.004v1h7.008V7Z"></path>
  </svg> Events </summary> 

```javascript
import { populateRepeater } from 'public/repeater';
import { reserveTickets } from 'public/reserveTickets';
import { items } from "@wix/data";

$w.onReady(async function () {
    await setupRepeater();
    $w('#button1').onClick(() => {
        reserveTickets();
    });
});

async function setupRepeater() {
    const collectionItems = await items.query("Events/Tickets").find();
    populateRepeater($w('#ticketsRepeater'), collectionItems.items);
}
```
</details>

<details open> 
<summary> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 18" width="22" height="22">
    <path d="M16.003 15.18c0 .57-.11 1.01-.31 1.32.2.31.31.75.31 1.32 0 .94.33 1.22.53 1.24.27.02.481.25.471.52-.01.27-.22.48-.49.48-.521 0-1.512-.47-1.512-2.24 0-.51-.1-.74-.16-.81h-.06c-.06 0-.11 0-.16-.01a.505.505 0 0 1-.561-.29.522.522 0 0 1-.04-.21c0-.08 0-.17.04-.25.1-.22.35-.32.58-.27h.2c.06-.06.17-.29.17-.81 0-1.77.992-2.24 1.513-2.24.28 0 .5.22.5.5s-.22.5-.5.5c-.18.02-.511.3-.511 1.24l-.01.01Zm5.967 1.1c-.09-.22-.33-.33-.57-.28h-.211c-.06-.06-.17-.29-.17-.81 0-1.77-.991-2.24-1.512-2.24-.27 0-.48.21-.49.48-.01.27.2.5.47.52.2.02.53.3.53 1.24 0 .57.11 1.01.311 1.32-.2.31-.31.75-.31 1.32 0 .94-.33 1.22-.511 1.24-.28 0-.5.22-.5.5s.22.5.5.5c.52 0 1.512-.47 1.512-2.24 0-.51.1-.74.16-.81h.06c.06 0 .11 0 .15-.01.23.06.47-.05.57-.27.041-.08.041-.17.041-.25 0-.07 0-.14-.04-.21h.01ZM17.014 4H6.001C5.451 4 5 4.45 5 5v14c0 .55.45 1 1.001 1h7.008v-1H6.001V5h11.013v6h1.001V5c0-.55-.45-1-1-1Zm-9.01 7h7.008v-1H8.004v1Zm7.008-4H8.004v1h7.008V7Z"></path>
  </svg> Home </summary> 

```javascript
import { reserveTickets } from 'public/reserveTickets';
import { items } from "@wix/data";

$w.onReady(async function () {
    await setupRepeater();
    $w('#buyButton').onClick(() => {
        reserveTickets();
    });
});

async function setupRepeater() {
    const collectionItems = await items.query("Events/Tickets").find();
    $w('#ticketsRepeater').data = collectionItems.items;

     $w('#ticketsRepeater').onItemReady(($item, ticket) => {
        $item('#ticketPrice').text = `$${ticket.price}`;
        $item('#ticketName').text = ticket.name;
        $item('#ticketDescription').text = ticket.description
    });


}
```
</details>

<!-- Static content -->
## Get Help
--- 
### Join the community 

Join the [Wix Studio][discord-community] community on Discord, where experienced developers and fellow creators come together to share tips, troubleshoot issues, and collaborate.

### Hire a developer 

Building a coded solution on your own can be challenging. Let an experienced Wix developer build it for you, so you can keep working on your site or business.
Visit the [Wix Marketplace][wix-marketplace] to find a trusted developer. 

<!-- Predefined links -->
[discord-community]: https://discord.com/invite/GhdmDN926z 
[wix-marketplace]: https://www.wix.com/marketplace/brief-auto-match/web-developer?entry=velo&origin=examples-page "Wix Marketplace"