Support WooCommerce Extra Product Options Pro by ThemeHigh (For making compatible with and without

Support WooCommerce Extra Product Options Pro by ThemeHigh, compatible with and without price options.

// From Woo Discount Rules v1.9.6

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'])){
		  if(!empty($cart_item['thwepo_options']['rdsn_initials'])){
			  return true;
		  }
      }
      return false;
    }
}

add_filter('woo_discount_rules_has_price_override', 'woo_discount_rules_has_price_override_method', 10, 4);
//woo_discount_rules_load_original_price_on_get_cheapest_product
add_filter('woo_discount_rules_load_original_price_on_get_cheapest_product', function($load_original_price, $cart_item){
	if(!empty($cart_item['thwepo_options'])){
		  if(empty($cart_item['thwepo_options']['rdsn_initials'])){
			  $load_original_price = true;
		  }
      }
      return $load_original_price;
}, 10, 2);

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'])){
					if(!empty($cart_item['thwepo_options']['rdsn_initials'])){
						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);