-
Is it possible to apply a discount to a multibooking if they have booked all events in the recurrence? The simple code I have written is below, my intention is to check the amount of seats booked against the recurrence ID to evaluate if they have booked all the events so that I can apply the discount. For testing purposes I have hardcoded the the event count and then I have attempted to evaluate the seat count. In this scenario the condition is never met because the filter is being called for every seat making the $seats variable equal to 1. Is there a way round this? `
} I've had a shuffle through the documentation and found eme_eval_multibooking_form_post_filter filter, but I'm not sure if i would be able to apply a discount update this way. I had a look on the old forum and found this thread https://www.e-dynamics.be/wordpress/forums/topic/multibooking-scenario/ that says it isn't possible, but was a very long time ago. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
eme_eval_multibooking_form_post_filter is for evaluation, it won't change anything and is run before the bookings are inserted into the db. So that'll not work. The problem with multibooking discounts is that I wouldn't know for which event to apply the calculated discount to (because in the end the price is per booking for an event).
$key contains the event id, so in the foreach you could just count the events with a bookedSeats value>0 or so ... |
Beta Was this translation helpful? Give feedback.
eme_eval_multibooking_form_post_filter is for evaluation, it won't change anything and is run before the bookings are inserted into the db. So that'll not work. The problem with multibooking discounts is that I wouldn't know for which event to apply the calculated discount to (because in the end the price is per booking for an event).
You could use the regular discount filter (as above), but you'd need to check also the POST output from the submit to see if all your conditions are met, and then based on that return a discount for that particular booking. An example of checking the POST info is found in eme_eval_multibooking_form_post_filter: