Event Booking & Ticket Tracking with Fluent Forms & ACF

We are going to be creating a booking form that dynamically populates the price of the ticket from a custom post type and then keeps track of how many tickets are available. It will stop people booking more than the available tickets and give them the appropriate error.

Demo

Setup

1. Create a new post type

I am using ACF Extended to create my post types, but CPTUI plugin would also work.

image 8

2. Create Event Price field

We need to create a number field to store the price of the event.

Set the field_name to event_price

image 7

3. Create Event Tickets field

We need to create a number field to store the number of tickets for the event.

Set the field_name to event_tickets

image 6

4. Add a new event and populate fields

image 5

5. Create a new form

Add two number fields: event_price and event_tickets

The fields need to have the name attributes set under the advanced tab as event_price and event_tickets respectively.

image 4

6. Post ID field

Add a field to store the post ID of the event.

Make sure you set the default value to {embed_post.ID}

image 3

7. Create your Event template

I am using GeneratePress & GenerateBlocks in this example. However you can use whatever builder or theme you like.

The only important thing is that you add the Fluent Form you just created somewhere inside the template, using the supported Gutenberg block or shortcode method.

image 2

The Code

Copy and paste the code below into your functions.php or code snippet plugin.

Make sure you update the Form ID's to your form

Members content only

Become a SnippetClub member to gain instant access to this tutorial plus tons more premium content.

Already a member? Log in below.

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

🔒I won't send you spam, I promise