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_format_sale_price_range', function($html, $min_price, $max_price){ | |
| $html = wc_price($min_price); | |
| return "From ".$html; | |
| }, 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_has_switch_back_option', '__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
| /** | |
| * @param $discount_prices array | |
| * @param $product object | |
| * @param $quantity int | |
| * @param $cart_item array | |
| * @return array | |
| * */ | |
| add_filter('advanced_woo_discount_rules_discount_prices_of_product', function ($discount_prices, $product, $quantity, $cart_item){ | |
| //FOR CHANGING DISCOUNTED_PRICE you can change it in $discount_prices['discounted_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_filter( 'woocommerce_cart_item_subtotal' ,function($sub_total, $cart_item, $cart_item_key){ | |
| if(isset($cart_item['data']->awdr_discount_price) && !empty($cart_item['data']->awdr_discount_price)){ | |
| if (isset($cart_item['line_total']) && function_exists('wc_price')) { | |
| return wc_price($cart_item['line_total'], array()); | |
| } | |
| } | |
| return $sub_total; | |
| }, 1000, 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_filter_passed', function ($filter_passed, $rule, $product, $sale_badge) { | |
| //'array(1,2)' - give rule id as you needed | |
| if (in_array($rule->getId(), array(407)) && class_exists('\Wdr\App\Helpers\Woocommerce')) { | |
| $rule_filter = $rule->getFilter(); | |
| $categories = \Wdr\App\Helpers\Woocommerce::getProductCategories($product); | |
| $category_ids = array(); | |
| if ($rule_filter) { | |
| foreach ($rule_filter as $filter) { | |
| $type = isset($filter->type) ? $filter->type : ''; | |
| if ($filter->method == 'in_list') { |
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('woocommerce_before_mini_cart_contents', function (){ | |
| if (!WC()->cart->is_empty()){ | |
| WC()->cart->calculate_totals(); | |
| } | |
| }); |
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_exclude_hooks_from_removing', function($allowed_hooks){ | |
| if(isset($allowed_hooks['woocommerce_checkout_order_processed'])){ | |
| unset($allowed_hooks['woocommerce_checkout_order_processed']); | |
| } | |
| return $allowed_hooks; | |
| }); |
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_hide_zero_value_coupon_html', function($coupon_html, $original_coupon_html, $coupon){ | |
| if (class_exists('\Wdr\App\Helpers\Woocommerce')) { | |
| $zero_price_html = '-' . \Wdr\App\Helpers\Woocommerce::formatPrice(0); | |
| $coupon_html = str_replace($zero_price_html, "", $coupon_html); | |
| } | |
| return $coupon_html; | |
| }, 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_custom_target_for_simple_product_on_qty_update', function(){ | |
| return "div.product-content.right div.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_filter('advanced_woo_discount_rules_exclude_hooks_from_removing', function($allowed_hooks){ | |
| if(isset($allowed_hooks['woocommerce_before_calculate_totals'])){ | |
| unset($allowed_hooks['woocommerce_before_calculate_totals']); | |
| } | |
| return $allowed_hooks; | |
| }); |