• I’m trying to get the numbers of real-time coupons left for a coupon in my Woocommerce installation as I’d like to show a countdown on my homepage.

    The coupons are actually published as pages, so it should be possible, but so far I only got it to show if the coupon is valid or not, not the actual number of coupons left for users to use.

    Could someone give me a hand? Ideally the code should be usable directly from a page, but I’m fine with php.

    Thanks!

    https://wordpress.org/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    The coupons are actually published as pages, so it should be possible

    What do you mean by this?

    Thread Starter Orlando

    (@stocktex)

    If I’m not mistaken they get registered in the DB as page/posts, so what I mean is that it should be possible to get this information, but I tried searching for plugins to get this particular information but none that I can find provide it.

    To be specific, the quantity I’m referring to is the “Usage limit per coupon”.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Doing a query based on usage limit would be terribly slow.

    It might be better to tackle this in 2 ways:

    1. Make it so when usage limits are hit, the coupons are deleted. Takes custom code.
    2. Once thats in place, you can get the count with a simple call to https://codex.wordpress.org/Function_Reference/wp_count_posts

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get Number of Coupons left’ is closed to new replies.