Posted: July 24, 2019 at 4:01 am
|
Hello everybody, I have a question about restricting ticket orders for specific users. At the moment the site is not online, it is currently being built with the non-profit organization founder and me. The website is intended for needy children and adolescents – children and adolescents who can not afford such an event. Since we want to provide access to such an event to as many children and adolescents as possible, we want to introduce a kind of “limit on ticket reservation”. The “Ticket-Limit” should e.g. look like this: Is this possible? Thank you in advance! |
Hi there, In short, yes its possible. However, we don’t have anything built within Event Espresso to do it out of the box so you’re going to need custom development. Assuming you require users to log into the site to register (I’m not sure how it would work otherwise) you could add a count of registrations to user meta as they add registrations (or, more likely as the registrations are set to Approved). So then it would be a case of hooking into EE as it processes new registrations, checking that value and either rejecting the registrations based on the current value or incrementing the value as they add more. There are a few different ways you could do this but assuming you are a developer and comfortable with PHP you can check out the That hook is used by the WP User Integration add-on (which you have access to so could take a look at the code used there for an example) to perform a check on the details and confirm if a user already exists matching the email used, if they do and the current user is not logged in it prevents the registration and displays an error, you could do something similar based on the user_meta value (or you could even pull registrations connected to the users contact and count those directly without using user meta if preferred, that’s a little slower but possibly more accurate depending on your use case). Or, you could do something like this: https://gist.github.com/Pebblo/10669adfeea322ade3d96a38857fb46b Which doesn’t do what you need as it removes the ticket selector for an event if there is a single registration linked to the current contact for the event in question but you could do something and check for registrations, then remove the ticket selector completely if they have 50 or more for the year. |
|
The support post ‘Annual ticket limit for users’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.