Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Balakrishnan-flycart/5c61c8c74771d1dee4a8a8113b3bd42f to your computer and use it in GitHub Desktop.
Save Balakrishnan-flycart/5c61c8c74771d1dee4a8a8113b3bd42f to your computer and use it in GitHub Desktop.
WooCommerce Gravity Forms Conflict
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