Guest User

Untitled

a guest
Jan 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2.  
  3. /** ticket 113379 */
  4. if ( class_exists( 'YITH_WC_Points_Rewards_Redemption' ) ) {
  5. add_filter( 'ywpar_calculate_rewards_discount_max_discount', 'ywpar_calculate_rewards_discount_max_discount' );
  6. function ywpar_calculate_rewards_discount_max_discount( $max_discount ) {
  7. return floatval( intval( $max_discount ) );
  8. }
  9.  
  10. add_filter( 'ywpar_calculate_rewards_discount_max_points', 'ywpar_calculate_rewards_discount_max_points', 10, 3 );
  11. function ywpar_calculate_rewards_discount_max_points( $max_points, $obj, $conversion ) {
  12. if( $obj->get_conversion_method() == 'fixed')
  13. $max_points = ( $obj->get_max_discount() * $conversion['points'] ) / $conversion['money'];
  14. return floatval( intval( $max_points ) );
  15. }
  16. }
Add Comment
Please, Sign In to add comment