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
| // Style Bulk Discount Table | |
| add_action('wp_head', function () { | |
| ?> | |
| <style type="text/css"> | |
| .awdr-bulk-customizable-table table, | |
| .awdr-bulk-customizable-table td, | |
| .awdr-bulk-customizable-table th { | |
| border: 1px solid black !important; | |
| padding: 4px 8px; | |
| } |
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
| // Reverse Strikeout Price (Swap - del and ins HTML tag) | |
| add_filter('advanced_woo_discount_rules_strikeout_price_html', function ($html, $original_price, $discounted_price, $is_variable_product, $initial_price_html, $separator) { | |
| if ($original_price != $discounted_price) { | |
| if ($initial_price_html) { | |
| $html = '<ins>' . $discounted_price . '</ins>' . $separator . '<del>' . $initial_price_html . '</del>'; | |
| } else { | |
| $html = '<ins>' . $discounted_price . '</ins>' . $separator . '<del>' . $original_price . '</del>'; | |
| } | |
| } | |
| return $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
| // Round Sale Badge Discount Percentage (zero decimal) | |
| add_filter('advanced_woo_discount_rules_percentage_value_on_sale_badge', function ($percentage_value_rounded, $percentage_value, $_product) { | |
| return round($percentage_value, 0); | |
| }, 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
| // Only Show Sale/Discount Price in Strikeout (Remove Initial/Original Price Html - Del tags) | |
| add_filter('advanced_woo_discount_rules_strikeout_price_html', function ($html, $original_price, $discounted_price, $is_variable_product, $initial_price_html, $separator) { | |
| if ($original_price != $discounted_price) { | |
| $html = '<ins>' . $discounted_price . '</ins>'; | |
| } | |
| return $html; | |
| }, 10, 6); |
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
| // Force Recalculate Cart Totals | |
| if (!function_exists('woo_discount_rules_force_recalculate_cart_totals')) { | |
| add_action('woocommerce_before_cart', 'woo_discount_rules_force_recalculate_cart_totals'); // before cart page | |
| add_action('woocommerce_before_cart_totals', 'woo_discount_rules_force_recalculate_cart_totals'); // before cart totals | |
| add_action('woocommerce_before_checkout_form', 'woo_discount_rules_force_recalculate_cart_totals'); // before checkout page | |
| add_action('woocommerce_checkout_update_order_review', 'woo_discount_rules_force_recalculate_cart_totals'); // during order review | |
| function woo_discount_rules_force_recalculate_cart_totals() { | |
| if (function_exists('WC')) { | |
| if (isset(WC()->cart) && WC()->cart != null) { | |
| if (method_exists(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
| <?php | |
| $_product = wc_get_product( $atts['id'] ); | |
| $discount = false; | |
| if (has_filter('advanced_woo_discount_rules_get_product_discount_price_from_custom_price')) { | |
| $discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', 0, $_product, 1, 0, 'all', true, false); | |
| if($discount !== false){ | |
| $percentage = ($discount['discounted_price'] / $discount['initial_price']) * 100; | |
| } | |
| } | |
| if ($discount === 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 Quick View (by Barn2) Issue on Shortcode | |
| add_action('woocommerce_before_shop_loop', function () { | |
| add_filter('wc_quick_view_pro_scripts_enabled_on_page', function() { | |
| 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
| // To change the price strikeout html priority to max. | |
| add_action('wp_loaded', function() { | |
| if(class_exists('\Wdr\App\Router')){ | |
| remove_filter('woocommerce_get_price_html', array(\Wdr\App\Router::$manage_discount, 'getPriceHtml'), 100, 2); | |
| add_filter('woocommerce_get_price_html', array(\Wdr\App\Router::$manage_discount, 'getPriceHtml'), PHP_INT_MAX, 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
| // Exclude child products compatibility for WooCommerce Product Bundles (by SomewhereWarm and WooCommerce) | |
| 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); | |
| add_filter('advanced_woo_discount_rules_include_cart_item_to_count_quantity', function($take_count, $cart_item){ | |
| if(isset($cart_item['bundled_item_id']) && !empty($cart_item['bundled_item_id'])){ | |
| $take_count = 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
| // Disable Sale badge for Free Shipping | |
| add_filter('advanced_woo_discount_rules_filter_passed', function ($filter_passed, $rule, $product, $sale_badge, $product_table, $conditionFailed) { | |
| if ($rule->rule->discount_type == 'wdr_free_shipping') { | |
| if ($sale_badge == true) { | |
| return false; | |
| } | |
| } | |
| return $filter_passed; | |
| }, 10, 6); |
OlderNewer