Last active
January 9, 2020 11:41
-
-
Save Balakrishnan-flycart/5c61c8c74771d1dee4a8a8113b3bd42f to your computer and use it in GitHub Desktop.
WooCommerce Gravity Forms Conflict
This file contains 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
if(!function_exists('woo_discount_rules_before_apply_discount_method')){ | |
function woo_discount_rules_before_apply_discount_method($amount, $product, $cart_item){ | |
if(isset($cart_item['_gform_total']) && !empty($cart_item['_gform_total'])){ | |
$addon_price = (int)$cart_item['_gform_total']; | |
$amount = isset($amount) && !empty($amount) ? (int)$amount : 0; | |
$total_amount = $amount+$addon_price; | |
return $total_amount; | |
} | |
return $amount; | |
} | |
} | |
add_filter('woo_discount_rules_before_apply_discount', 'woo_discount_rules_before_apply_discount_method', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment