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
| // To override Cart Page Overrides (increase priority to higher) | |
| add_action('wp_loaded', function() { | |
| if(class_exists('\Wdr\App\Router')){ | |
| remove_action('woocommerce_before_calculate_totals', array(\Wdr\App\Router::$manage_discount, 'applyCartProductDiscount'), 1000); | |
| add_action('woocommerce_before_calculate_totals', array(\Wdr\App\Router::$manage_discount, 'applyCartProductDiscount'), PHP_INT_MAX); | |
| remove_all_filters('woocommerce_cart_item_price'); | |
| add_filter('woocommerce_cart_item_price', array(\Wdr\App\Router::$manage_discount, 'getCartPriceHtml'), 1000, 3); | |
| if (has_filter('woocommerce_cart_item_subtotal', array(\Wdr\App\Router::$manage_discount, 'getCartProductSubtotalPriceHtml'))) { | |
| add_filter('woocommerce_cart_item_subtotal', array(\Wdr\App\Router::$manage_discount, 'getCartProductSubtotalPriceHtml'), 10, 3); | |
| } |
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_modify_price_html', function($result, $price_html, $product, $quantity){ | |
| // is_page( 'cart' ) -> cart is a page slug | |
| if ( is_page( 'cart' ) || is_cart() ) { | |
| return false; | |
| } | |
| return $result; | |
| }, 10, 4); |
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){ | |
| $search_result_limit = 50; | |
| 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
| 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)); |