Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

WooCommerce Coupon expired early I believe due to UTC time

Scheduled Pinned Locked Moved WordPress (Developer)
5 Posts 3 Posters 271 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • d19dotcaD Offline
    d19dotcaD Offline
    d19dotca
    wrote on last edited by
    #1

    Hello,

    I have a new customer who wanted me to help them make a new coupon in WooCommerce for a launch sale which was supposed to go until end of September. There's a few hours left in the day of September 30, 2021, but they said they had a customer just try and it says it expired (the expiry date is set to October 1, 2021). I believe it's because the WordPress install sees the time as October 1 by a few hours because of UTC (which is basically about ~8 hours ahead of me in Pacific Time).

    I've worked around it by temporarily extending it by a day, but how would I permanently resolve this for future times? If a user wants a coupon to expire on October 1, then a customer submitting an order on September 30th even at 11 PM should still be successfully able to use the coupon code. How does one permanently resolve this behaviour?

    Has anyone else run into this issue before?

    --
    Dustin Dauncey
    www.d19.ca

    martinkbsM 1 Reply Last reply
    0
  • martinkbsM Offline
    martinkbsM Offline
    martinkbs
    replied to d19dotca on last edited by
    #2

    Hi @d19dotca ,

    It is a common problem when the time zone is not configured correctly in WordPress.

    You just have to adjust the time zone with the capital of your country, and WordPress will automatically adjust the web to match the local time.

    Captura de pantalla 2021-10-01 a las 11.15.20.png

    With that, the WooCommerce coupon will expire on the date and time that you have defined as its limits. πŸ˜‰

    d19dotcaD 1 Reply Last reply
    1
  • girishG Do not disturb
    girishG Do not disturb
    girish Staff
    wrote on last edited by girish
    #3

    I guess we have to ask WooCommerce what timezone/time they take into account when checking for expiry. But looking into server time seems like an easy way to circumvent expiry πŸ™‚ Usually, coupons are polled for expiry on the WooCommerce side. So, if anything, it's possible WooCommerce servers behaving differently than expected?

    Also, apart from what @martinkbs said, I think you can also change the timezone in php.ini using date.timezone = "US/Pacific" for example.

    1 Reply Last reply
    1
  • d19dotcaD Offline
    d19dotcaD Offline
    d19dotca
    replied to martinkbs on last edited by
    #4

    @martinkbs mine is correctly configured for the time zone; so that doesn’t seem to be the issue (I meant to include that in my original post sorry for missing that). It seems to be working off the server time and not the local time zone time.

    --
    Dustin Dauncey
    www.d19.ca

    1 Reply Last reply
    0
  • d19dotcaD Offline
    d19dotcaD Offline
    d19dotca
    wrote on last edited by
    #5

    @martinkbs & @girish - So I found the documentation for WooCommerce which does seem to state that it uses the time zone: https://docs.woocommerce.com/document/smart-coupons/how-to-set-expiry-time-with-the-expiry-date/

    However that definitely wasn't my experience. Here's a screenshot I took yesterday and meant to include in my original posting, showing the local time zone not yet at October 1st but the server time was October 1st, which is why I strongly believed the code was marked expired because it was looking at the server time instead (it was the only explanation that made sense):

    Screen Shot 2021-09-30 at 9.35.52 PM.png

    I have created a new coupon code for them which I set to expire on November 1 so I'll try to remember to test out later in the evening of October 31st. I'll also try to duplicate this website to a staging domain and test as well as that'll probably be much quicker so I won't have to wait πŸ˜‰ hahaha. I'll try to report back with my test results.

    --
    Dustin Dauncey
    www.d19.ca

    1 Reply Last reply
    1

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Login

  • Don't have an account? Register

  • Login or register to search.