Skip to content

Instantly share code, notes, and snippets.

@cklosowski
Created May 30, 2018 02:10
Show Gist options
  • Save cklosowski/15badf629336dbf19c87c8c1545e50d3 to your computer and use it in GitHub Desktop.
Save cklosowski/15badf629336dbf19c87c8c1545e50d3 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Easy Digital Downloads - Grandfather Renewal Rate
* Description: Allows a custom renewal discount to be set for customers who purchased before a custom date
* Author: Pippin Williamson
* Author URI: https://easydigitaldownloads.com
* Version: 1.0
*/
/*
* Sets renewal discount to 40% for any customer that purchased before April 18, 2016
*/
function pw_edd_grandfather_renewal_discount( $renewal_discount, $license_id ) {
$license = edd_software_licensing()->get_license( $license_id );
if( strtotime( $license->date_created ) < strtotime( 'April 18, 2016' ) ) {
$renewal_discount = 40;
}
return $renewal_discount;
}
add_filter( 'edd_sl_renewal_discount_percentage', 'pw_edd_grandfather_renewal_discount', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment