Last active
May 9, 2018 16:18
-
-
Save danielmilner/3086d1b94ead339ea7815ce2435ca478 to your computer and use it in GitHub Desktop.
EDD Software Licensing Time-Based Prorate Limit #edd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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