Support » Plugin: Subscriber Discounts for WooCommerce » Set expiration date

  • Resolved drigis3

    (@drigis3)


    How set expiration date in generated new coupon code? This code from old post don’t work in create-discount.php

    $expDate = date(‘Y-m-d’, strtotime(“+60 days”));
    update_post_meta( $new_coupon_id, ‘expiry_date’, $expDate );

Viewing 1 replies (of 1 total)
  • Plugin Author Scott DeLuzio

    (@scottdeluzio)

    Thanks for noticing this @drigis3. I have an update I’ll be releasing shortly that will address this issue. Short answer is the expiry_date meta is incorrect in the plugin and instead needs to be date_expires. Additionally, the date_expires meta is looking for a timestamp (such as 1602547200) and the $expDate in your example would produce a human readable date (such as 2020-10-13).
    Regardless, I’ll have a fix released that will allow you to set the number of days before the coupon code should expire. In your example, you could set 60 days and the code would automatically expire 60 days from the date it is created. The update should be available in a few hours.

Viewing 1 replies (of 1 total)
  • The topic ‘Set expiration date’ is closed to new replies.