danielmilner
1/21/2017 - 1:11 AM

EDD Software Licensing Time-Based Prorate Limit

EDD Software Licensing Time-Based Prorate Limit

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;

}
add_filter( 'edd_sl_get_time_based_pro_rated_upgrade_cost', 'my_prefix_edd_sl_time_based_prorate_limit', 10, 4 );