Support

Home Forums Event Espresso Premium Tickets are reserved for too long?

Tickets are reserved for too long?

Posted: March 2, 2018 at 5:28 pm


jacl

March 2, 2018 at 5:28 pm

Hi

Am I right in saying that if someone starts the registration process and leaves the site EE will reserve that ticket for 1 hour?

That is way too long for my client who sells motorbike training classes with 11 seats max….. They can get 20-30 boookinds per day so quite busy and if just a few get reserved blocking others from booking they’ll go to a competitor….

Is there any way to have the ticket released as soon as they navigate away from the registration form? or even to reduce it from 1 hour to something much smaller?

Josh I see you have created a plugin that sets up a cron to purge reserved tickets each hour…. could that be used to also run every 10 mins? or could that kill off an active registration thats in progress too?

Any advice welcome as my client really needs a solution to this

Thanks so much
Jonathan


Tony

  • Support Staff

March 5, 2018 at 2:42 am

Am I right in saying that if someone starts the registration process and leaves the site EE will reserve that ticket for 1 hour?

Yes, the default session lifespan is 1 hour.

Is there any way to have the ticket released as soon as they navigate away from the registration form?

No, because there’s no reliable way for EE to know that has happened. But…

or even to reduce it from 1 hour to something much smaller?

Yes, you can change the lifespan using a filter, something like this:

https://gist.github.com/Pebblo/b6e20b03c57efe693bd86ebcf1b00ce9

Will set the session lifespan to 15mins which is the loest value I would use personally. You can add that to your child themes functions.php file or preferably a custom functions plugin:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

Note that users would need to select ticket, provide all of the registration information you are requesting and complete payment before the session expires. If they get half way through and the session ends the will need to restart the registration from the beginning again.

Josh I see you have created a plugin that sets up a cron to purge reserved tickets each hour…. could that be used to also run every 10 mins? or could that kill off an active registration thats in progress too?

The session lifespan is how long the session is considered active, the cron job is the function that removes the ‘expired’ reserved tickets and adds them back to the available tickets. So it’s the session lifespan that will kill off active registrations, not the cron.

The shortest cron interval WP has by default is ‘hourly’ so if you want the above to run more frequently you would need you own custom cron interval of say 15 mins, doing so isn’t all that complicated and heres and example of adding a custom interval:

https://wordpress.stackexchange.com/questions/208135/how-to-run-a-function-every-5-minutes

(Thats for 5 mins, you would be better with 15 imo, but that’s up to you)

Something to keep in mind is additional wp_crons, especially shorter interval crons, will increase the load on the server. The alternative is to disable WP_CRON and set up a real cron job on your site, theres a like with an explanation on doing so in the stackexchange thread I linked to.


jacl

March 7, 2018 at 4:01 am

Hi Tony

Thanks so much for that great explanation. I have now implemented your code to my plugin to set session to expire after 15 minutes. I might add a note at the start of the registration that tells people their ticket is reserved for 15 mins only…

So after 15 minutes the session expires but am I right in saying that the ticket is still reserved and taking up 1 space on that event until the hourly purge takes place on expired reserved tickets?

I can’t now for the life of me find that post or solution that I’m sure Josh posted on here or github to purge expired reserved tickets every say 15 mins?

Anyone know if I need that as well or where to find it

thank you so much


Tony

  • Support Staff

March 7, 2018 at 5:44 am

So after 15 minutes the session expires but am I right in saying that the ticket is still reserved and taking up 1 space on that event until the hourly purge takes place on expired reserved tickets?

That’s correct.

I can’t now for the life of me find that post or solution that I’m sure Josh posted on here or github to purge expired reserved tickets every say 15 mins?

I think the thread you are referring to is this one:

https://eventespresso.com/topic/events-not-sold-out-yet-people-unable-to-register-continued/#post-254155

Which links to this code:

https://gist.github.com/joshfeck/19cf49a2a30e939cca6d0a7014f7c183

It adds another hourly cron event as well as the default event to make sure the ticket reservation are reset. If you want a more frequent reset than hourly you’ll need to add your own schedule as hourly is the shortest default from WP.


jacl

March 7, 2018 at 6:42 am

Hi Tony

Thanks for getting that link for me…

I’ve now added that code to my custom plugin and have installed an advanced cron plugin so i can see all cron tasks and schedules.

I can see the new tasks set for hourly and using these schedules I can change it from “hourly” to “twiceanhour” to get it to run every 30 mins

Great 🙂

The support post ‘Tickets are reserved for too long?’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  jacl 6 months, 3 weeks ago ago

Topic Tags

Notifications

This topic is:
pending
Do NOT follow this link or you will be banned from the site!