Skip to content

Instantly share code, notes, and snippets.

@danielmilner
Last active May 9, 2018 16:18
Show Gist options
  • Select an option

  • Save danielmilner/3086d1b94ead339ea7815ce2435ca478 to your computer and use it in GitHub Desktop.

Select an option

Save danielmilner/3086d1b94ead339ea7815ce2435ca478 to your computer and use it in GitHub Desktop.
EDD Software Licensing Time-Based Prorate Limit #edd
add_filter( 'edd_sl_get_time_based_pro_rated_upgrade_cost', 'my_prefix_edd_sl_time_based_prorate_limit', 10, 4 );
function my_prefix_edd_sl_time_based_prorate_limit( $prorated, $license_id, $old_price, $new_price ) {
$price_difference = $new_price - $old_price;
$protate_limit_percent = '50';
$prorate_limit_price = round( ( $price_difference / 100 ) * $prorate_limit_percent );
if ( $prorated < $prorate_limit_price ) {
return round( $prorate_limit_price, edd_currency_decimal_filter() );
}
return $prorated;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment