This file contains hidden or 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
| add_filter('advanced_woo_discount_rules_select_search_limit', function($search_result_limit){ | |
| if($search_result_limit <= 20){ | |
| return 500; | |
| } | |
| return $search_result_limit; | |
| }, 10, 1); |
This file contains hidden or 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
| add_filter('advanced_woo_discount_rules_do_apply_price_discount', function($return, $price, $cart_item, $cart_object, $calculated_cart_item_discount){ | |
| if (class_exists('\Wdr\App\Helpers\Woocommerce') && class_exists('\Wdr\App\Controllers\ManageDiscount')) { | |
| $cart_item_key = isset($cart_item['key']) ? $cart_item['key'] : ''; | |
| $discount_details = isset($calculated_cart_item_discount['total_discount_details']) ? $calculated_cart_item_discount['total_discount_details'] : ''; | |
| if(isset($discount_details[$cart_item_key])&& !empty($discount_details[$cart_item_key])){ | |
| foreach($discount_details[$cart_item_key] as $rule_id => $rule_data){ | |
| $applied_coupons = \Wdr\App\Helpers\Woocommerce::getAppliedCoupons(); | |
| if( in_array($rule_id, array(1, 2, 3)) && !empty($applied_coupons)){ //array(1,2,3) -> enter your rule id(s) | |
| foreach($applied_coupons as $coupon_code){ | |
| $remove_msg = __( 'Coupon code applied successfully.', 'woocommerce' ); |
This file contains hidden or 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
| function odb_facebook_sync_price_update($price, $facebook_price, $product){ | |
| if ( ! $facebook_price && $product instanceof \WC_Product ) { | |
| $discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $price, $product, 1, $price, 'discounted_price', true, true); | |
| if($discount !== false){ | |
| $price = $discount; | |
| } | |
| } | |
| return $price; | |
| } |
This file contains hidden or 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
| function woocommerce_get_price_html_woo_discount_on_sale_compatible($item_price, $product){ | |
| $del_pattern = '/<del aria-hidden="true">(.*?)<\/del>/s'; | |
| preg_match($del_pattern, $item_price, $matches); | |
| $del_content = isset($matches[1]) ? $matches[1] : ''; | |
| $del_content = trim(strip_tags($del_content)); | |
| $ins_pattern = "/<ins>(.*?)<\/ins>/s"; | |
| preg_match($ins_pattern, $item_price, $matches); | |
| $ins_content = isset($matches[1]) ? $matches[1] : ''; | |
| $ins_content = trim(strip_tags($ins_content)); |
This file contains hidden or 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
| add_filter('advanced_woo_discount_rules_run_discount_rules', function($run_rule, $cart_object){ | |
| if (class_exists('\Wdr\App\Helpers\Woocommerce')) { | |
| $applied_coupons = \Wdr\App\Helpers\Woocommerce::getAppliedCoupons(); | |
| $coupons_list = array('coupon1', 'coupon2'); // enter your coupon instead of "coupon1, coupon2" | |
| if (count(array_intersect($coupons_list, $applied_coupons)) > 0){ | |
| return false; | |
| } | |
| } | |
| return $run_rule; | |
| }, 10, 2); |
This file contains hidden or 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
| add_filter('advanced_woo_discount_rules_select_set_discount_type', function($static_type, $discount_type){ | |
| return $discount_type; | |
| }, 10, 2); | |
| add_filter('advanced_woo_discount_rules_calculate_current_discount_amount', function($current_discount_amount, $price_discount){ | |
| if($price_discount['discount_type'] == 'fixed_set_price' && isset($price_discount['discount_price']) && !empty($price_discount['discount_price'])){ | |
| return $price_discount['discount_price']; | |
| } |
This file contains hidden or 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
| add_action('advanced_woo_discount_rules_loaded', function (){ | |
| remove_action('woocommerce_shipping_init', 'WDRPro\App\Rules\FreeShipping::mayHaveFreeShipping'); | |
| }, 11); |
This file contains hidden or 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
| add_filter('advanced_woo_discount_rules_recalculate_cart_subtotal_manually', '__return_true'); |
This file contains hidden or 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
| add_filter('advanced_woo_discount_rules_csv_separator_fot_import', function($separator){ | |
| return ';'; | |
| }, 10, 1); |