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 discounted price to cart item data (product) | |
| add_filter('advanced_woo_discount_rules_discounted_price_of_cart_item', function ($price, $cart_item, $cart_object, $cart_item_key){ | |
| $do_apply_price_rules = apply_filters('advanced_woo_discount_rules_do_apply_price_discount', true, $price, $cart_item, $cart_object, $cart_item_key); | |
| if ($do_apply_price_rules) { | |
| $cart_item['data']->awdr_product_discounted_price = $price; | |
| } | |
| return $price; | |
| }, 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
| // Fix - Woodmart theme sale badge issue | |
| if ( ! function_exists( 'woodmart_child_product_label' ) ) { | |
| function woodmart_child_product_label() { | |
| global $product; | |
| if ( function_exists( 'woodmart_get_product_attributes_label' ) && function_exists( 'woodmart_get_opt' ) && function_exists( 'woodmart_is_new_label_needed' ) ) { | |
| $output = array(); | |
| $product_attributes = woodmart_get_product_attributes_label(); | |
| $percentage_label = woodmart_get_opt( 'percentage_label' ); |
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
| // Fix - Woodmart theme variation price display issue | |
| add_filter('advanced_woo_discount_rules_custom_target_for_variable_product_on_qty_update', function ($target) { | |
| $target = 'div.nb-price'; | |
| return $target; | |
| }, 10); |
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
| // Fix - Martfury theme sale badge issue | |
| if ( ! function_exists( 'martfury_child_product_ribbons' ) ) { | |
| function martfury_child_product_ribbons() { | |
| global $product; | |
| if ( function_exists( 'martfury_get_option' ) ) { | |
| $output = array(); | |
| $badges = (array) martfury_get_option( 'badges' ); | |
| // Change the default sale ribbon |
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
| // Fix - Woodmart theme (6.3+) sale badge issue | |
| if ( ! function_exists( 'woodmart_child_product_label' ) ) { | |
| function woodmart_child_product_label() { | |
| global $product; | |
| if ( function_exists( 'woodmart_get_product_attributes_label' ) && function_exists( 'woodmart_get_opt' ) && function_exists( 'woodmart_is_new_label_needed' ) && function_exists( 'woodmart_loop_prop' ) && function_exists( 'woodmart_enqueue_inline_style' ) ) { | |
| $output = array(); | |
| $product_attributes = woodmart_get_product_attributes_label(); | |
| $percentage_label = woodmart_get_opt( 'percentage_label' ); |
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
| // disable wpml language check for product before auto add | |
| add_filter('advanced_woo_discount_rules_check_wpml_language_for_product_before_auto_add', '__return_false'); |
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
| // Fix - RTL Cart Item Price quantity x issue | |
| add_filter('advanced_woo_discount_rules_cart_strikeout_quantity_html', function($html, $quantity) { | |
| return ' <span style="unicode-bidi: plaintext;">' . $quantity . ' x'; | |
| }, 100, 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
| // Fix - Buy X Get Y (Cheapest or highest) quantity count issue in cart | |
| add_filter('advanced_woo_discount_rules_calculate_cheapest_discount', function ($process, $rule, $cart_item, $is_cart){ | |
| if (!$is_cart) { | |
| $process = false; | |
| } | |
| return $process; | |
| }, 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_action('advanced_woo_discount_rules_after_initialize', 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'), 10000); | |
| } | |
| }); | |
| add_action('plugins_loaded', function() { | |
| if(class_exists('\Wdr\App\Router')){ | |
| remove_all_filters('advanced_woo_discount_rules_cart_strikeout_price_html'); |
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
| // Exclude bundle parent product quantity if is not BOGO discount | |
| // Exclude bundle child product quantity if is BOGO discount | |
| // Exclude bundle child products from apply discounts | |
| // for WooCommerce Product Bundles | |
| add_filter('advanced_woo_discount_rules_calculate_discount_for_cart_item', function ($calculate_discount, $cart_item){ | |
| if(isset($cart_item['bundled_item_id']) && !empty($cart_item['bundled_item_id'])){ | |
| $calculate_discount = false; | |
| } | |
| return $calculate_discount; | |
| }, 100, 2); |