Home Forums Event Espresso Premium Early discount

Early discount

Posted: September 14, 2012 at 8:12 am

Viewing 4 reply threads


September 14, 2012 at 8:12 am

The early discount is calculated to whole date and the code is wrong in function “early_discount_amount”. You are comparing the dates so that it always is yesterdays date that is valid. Please change the code, eg:

if ((strlen($eventdata[0]->early_disc) > 0) && (strtotime($eventdata[0]->early_disc_date) > strtotime(date(“Y-m-d”) . ” -1 day”))) {

Or add hours and minutes to the early discount textbox in administrators view!


September 18, 2012 at 6:43 am


Thanks for the feedback, I will raise an internal ticket to get this looked at.

Chris Reynolds

  • Support Staff

September 18, 2012 at 1:13 pm

What file are you seeing this in?


September 18, 2012 at 1:20 pm


Brent Christensen

  • Support Staff

October 15, 2012 at 10:45 am

Sorry for the delay getting to this as it was not a priority item.

The code is actually correct.

if ((strlen($eventdata[0]->early_disc) > 0) && (strtotime($eventdata[0]->early_disc_date) > strtotime(date(“Y-m-d”) . ” -1 day”))) {
// apply earley bird discount here

What this code is saying is:

IF early_disc value exists AND early_disc start date IS GREATHER THAN yesterday THEN apply early bird discount.

So let’s examine that last part “AND early_disc start date is GREATHER THAN yesterday” a little bit more, by actually throwing a date in there.

If we wanted our early bird discount to start on November 10, 2012, then that last bit of code would read like this:

AND Nov 10, 2012 IS GREATHER THAN Nov 9, 2012

which would be TRUE and your discount would be applied.

IF we did NOT subtract a day then it would read

AND Nov 10, 2012 IS GREATHER THAN Nov 10, 2012

which would be FALSE and your discount would NOT be applied, and would NOT be applied until Nov 11, 2012, which of course is not when we want it to begin.

Instead of subtracting a day, it maybe would have been easier to understand if it had been coded using >= “greater than or equals” ala:

AND Nov 10, 2012 IS GREATHER THAN OR EQUAL TO Nov 10, 2012

but ultimately it all reads the same.

Make sense now?

Viewing 4 reply threads

The support post ‘Early discount’ 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.

Event Espresso