Sarathlal N

Change / Disable the Easy Digital Download renewal discount if the license key expired

In Easy Digital Download plugin, there is an option to offer a discount when someone renews their order.

There is option to set discounts globally or for each download. But this renewal discount is always available for all renewal. But in one of my client’s store, he decided to remove this discount offer if the related license key is expired.

The solution is given below. You have to use this code snippet in your child theme’s functions.php file.

function th25r_edd_change_discount_after_license_expires( $renewal_discount, $license_id ) {
   $license = edd_software_licensing()->get_license( $license_id );
   if ( ! is_object( $license ) ) {
      // This can happen during purchase where the license ID is not yet valid
      return $renewal_discount;
   if ( $license->is_expired() ) {
      $renewal_discount = 0; 
   return $renewal_discount;
add_filter( 'edd_sl_renewal_discount_percentage', 'th25r_edd_change_discount_after_license_expires', 10, 2 );

Recent Posts

  1. Create dynamic image using Python with Pillow package
  2. Discard local changes in Git
  3. Remove last commit from Git repository
  4. Change the directory name of Git repository
  5. Handling form using AJAX in WordPress

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about it, please get in touch.