Created
January 12, 2018 13:10
-
-
Save kreamweb/e1996909cf5433bc8b7eaf801e2b1906 to your computer and use it in GitHub Desktop.
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
<?php | |
/** ticket 113379 */ | |
if ( class_exists( 'YITH_WC_Points_Rewards_Redemption' ) ) { | |
add_filter( 'ywpar_calculate_rewards_discount_max_discount', 'ywpar_calculate_rewards_discount_max_discount' ); | |
function ywpar_calculate_rewards_discount_max_discount( $max_discount ) { | |
return floatval( intval( $max_discount ) ); | |
} | |
add_filter( 'ywpar_calculate_rewards_discount_max_points', 'ywpar_calculate_rewards_discount_max_points', 10, 3 ); | |
function ywpar_calculate_rewards_discount_max_points( $max_points, $obj, $conversion ) { | |
if( $obj->get_conversion_method() == 'fixed') | |
$max_points = ( $obj->get_max_discount() * $conversion['points'] ) / $conversion['money']; | |
return floatval( intval( $max_points ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment