I only want my guests to be able to purchase 1 ticket at a time. How do I prevent my guests from opting to buy multiple tickets from my event page?
There is a slight theme modification you can make to prevent your guests from purchasing multiple tickets in one transaction. To prevent people from entering a value above 1 on your event page, you will want to set a maximum value for your rsvp field.
Look for the following code in your event page's template:
<div class="padtopmore"><strong>{{ ticket_level.form_quantity }}</strong></div>
Delete the liquid code, "{{ ticket_level.form_quantity }}" and replace it with the source code that creates this field. There are two ways to find the source code.
1. Right click on your page and select Google Chrome's "Inspect" tool:
OR 2. Right click on your page and select "View Page Source":
Find the text "Will you come?" and below it, locate the code for each of your ticket levels.
Typed out, this code is the following:
<input type="number" class="quantity" name="event_ticket_level[47]" value="0">
To set a maximum value, you can add the following parameters after the value (within the angle bracket): "min=0 max=1". The resulting code will look like this:
<input type="number" class="quantity" name="event_ticket_level[47]" value="0" min=0 max=1>
Notes:
1. In addition to setting minimums or maximums for your tickets per RSVP, you will also likely want to modify the language above this line that instructs users to, "Enter the number of tickets you would like to purchase."
2. If you regularly clone your event pages, beware of the fact that the number associated with the ticket level (i.e. "47") is unique to that exact ticket for your event. If you clone the event, you will need to use the inspect tool again to find the number that is appropriate to your new page's ticket.
Showing 6 reactions
Sign in with
I’ll answer my own question. If you want to limit people to selecting a single ticket, then it’s probably better to use a checkbox as the input element.
For my application I wanted to have multiple ticket types, but only let the user choose one, I did that by adding a bit of JavaScript to the onclick attribute of the input tag. The way the code works is that if you click on the checkbox, any other inputs of class “ticket” are unchecked.
<div><strong><input type=“checkbox” class=“ticket” name=“event_ticket_level3” value=“1” onclick=“$(‘input.ticket’).not(this).prop(‘checked’, false)”> £10.00 Saturday and Sunday (Full Price)</strong></div>
<div><strong><input type=“checkbox” class=“ticket” name=“event_ticket_level2” value=“1” onclick=“$(‘input.ticket’).not(this).prop(‘checked’, false)”> £5.00 Sunday Only (Full Price)</strong></div>
<div><strong><input type=“checkbox” class=“ticket” name=“event_ticket_level1” value=“1” onclick=“$(‘input.ticket’).not(this).prop(‘checked’, false)”> £5.00 Saturday Only (Full Price)</strong></div>
Thanks for sharing, Andrew.