Discount code expiration in Cart

Does anybody know when cart discounts expire? The inputs are % amount, and date. If I put 6/30/2023 in as the expiration, does the discount period end at midnight on 6/30 or 12.01am (ie, just after midnight the day before), and just as importantly, in whose timezone?!

Thx for any pointers, I guess I should just do trial and error, but I have a sale on at the moment. I could not find anything in the documentation to answer this question.

Thx in advance.

Hi @ttg-jim, the coupon expires at the end of the specified date. So if you specified June 24 then it should be usable till 11:59:59pm on June 24.

I’m still looking into the timezone. I’ll reply again when I’ve worked this out.

Hi @ttg-jim, I’ve looked further into this. The timezone should have been following the Timezone setting that is configurable in Backlight Settings > Personalization. I found however that there was an issue in using this setting during cart initialisation, so the cart was instead falling back to the system’s timezone which can be seen in Backlight > Special Links > View PHP Info.

(note that depending on your location, the system’s timezone may already have been correct for you).

I’ve put in a fix, available in Cart 8.1.4 from the Backlight Modules page. After updating you should find:

  1. That discounts are available until 11:59:59 PM on the configured expiry (this was already working).
  2. That the Backlight Settings > Personlization > Timezone setting will be used when checking discount expiries.
1 Like

Thank you @Ben , that’s really great. I updated to 8.1.4 and set my Timezone to America/Phoenix (lucky me, I have no daylight savings to worry about, ever). In personalization, I see I had not yet set a timezone, and it picked ‘UTC’ for me. This was the PHP info before the cart update, and before I chose a timezone:

After the 8.1.4 update, and choosing America/Phoenix as my timezone, the PHP info now reads thus (see below). Should I be concerned that Default timezone and date.timezone do not match? Which one will take precedence for the cart? (they are 1Hr different, with Boise being 1hr ahead of Phoenix now, but 0hr different in Winter).

1 Like

Hi @ttg-jim, Backlight only sets the default timezone, and from what I can tell that is what’s picked up when working out the current time for date comparisons. I’ll look further into this to confirm.

Hi @Ben , just wanted to close this out. Were you able to confirm timezone settings above will behave as expected? I’m unclear about the difference between ‘Default timezone’ and ‘date.timezone’ local/master.

Many thx,

Hi @ttg-jim, the value for date.timezone is what applies. If different, the “Local Value” takes precedence over the “Master Value”.

@Ben OK, that may be a problem. Right now we are in the same timezone as California (Pacific). My current php info (see capture below) thinks I’m in Mountain (Boise), which would end my discount an hour earlier than I have advertised. You see, Phoenix (Arizona) does not observe daylight savings, so in the winter we effectively share a timezone with Boise, but in the summer, with San Francisco. It appears your time algorithm is not correctly setting the timezone for Arizona, even though I set it to America/Phoenix.

Even more frustrating, I tried forcing my timezone to LA, but it still seems to be setting date.timezone to ‘America Boise’ ! So it appears to be setting date.timezone based on my location rather than my selected timezone. How does it actually know where I am?

Hi @ttg-jim, please disregard my last comment. I have tested further and the applied timezone is in fact the one set in the Backlight Timezone setting. This value should be reflected in the “Default timezone” setting of PHP Info.

I have also found that this expiry checking is performed when a user first interacts with the cart, and not at checkout.