Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshlinRejo/23da9a87e64579e42a85689b49842a8d to your computer and use it in GitHub Desktop.
Save AshlinRejo/23da9a87e64579e42a85689b49842a8d to your computer and use it in GitHub Desktop.
Discount rules: Round the subtotal before apply discount in cart for cart rules
function woo_discount_rules_before_calculate_discount_from_subtotal_in_cart_method($subtotal, $discount_type){
if(function_exists('wc_round_discount')){
$subtotal = wc_round_discount($subtotal, 0);
}
return $subtotal;
}
add_filter('woo_discount_rules_before_calculate_discount_from_subtotal_in_cart', 'woo_discount_rules_before_calculate_discount_from_subtotal_in_cart_method', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment