Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Woo Discount Rules: Support WooCommerce Extra Product Options Pro by ThemeHigh
if(!function_exists('woo_discount_rules_remove_event_woocommerce_before_calculate_totals_method')){
function woo_discount_rules_remove_event_woocommerce_before_calculate_totals_method($remove_event){
return true;
}
}
add_filter('woo_discount_rules_remove_event_woocommerce_before_calculate_totals', 'woo_discount_rules_remove_event_woocommerce_before_calculate_totals_method');
if(!function_exists('woo_discount_rules_has_price_override_method')){
function woo_discount_rules_has_price_override_method($hasPriceOverride, $product, $on_apply_discount, $cart_item){
if(!empty($cart_item['thwepo_options'])){
return true;
}
return false;
}
}
add_filter('woo_discount_rules_has_price_override', 'woo_discount_rules_has_price_override_method', 10, 4);
add_filter( 'woo_discount_rules_apply_rules_repeatedly', '__return_true' );
if(!function_exists('woo_discount_rules_skip_discount_for_free_product_method')){
function woo_discount_rules_skip_discount_for_free_product_method($skip_free_product, $cart_item){
$_product = $cart_item['data'];
if(!empty($_product)){
$price = $_product->get_price();
if($price == 0){
return true;
if(!empty($cart_item['thwepo_options'])){
return true;
}
}
}
return $skip_free_product;
}
}
add_filter('woo_discount_rules_skip_discount_for_free_product', 'woo_discount_rules_skip_discount_for_free_product_method', 10, 2);
if(!function_exists('woo_discount_rules_do_not_apply_discount_for_free_product_method')){
function woo_discount_rules_continue_before_apply_discount_method($apply_for_free_produc){
return false;
}
}
add_filter('woo_discount_rules_do_not_apply_discount_for_free_product', 'woo_discount_rules_do_not_apply_discount_for_free_product_method', 10);
if(!function_exists('woo_discount_rules_reduce_qty_skip_discount_for_free_product_method')){
function woo_discount_rules_reduce_qty_skip_discount_for_free_product_method($reduce_quantity, $cart_item){
$_product = $cart_item['data'];
if(!empty($_product)){
$price = $_product->get_price();
if($price == 0){
return $cart_item['quantity'];
}
}
return $reduce_quantity;
}
}
add_filter('woo_discount_rules_reduce_qty_skip_discount_for_free_product', 'woo_discount_rules_reduce_qty_skip_discount_for_free_product_method', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.