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 - Rule Discount Type selection issue from ARForms plugin | |
| add_action('admin_enqueue_scripts', function() { | |
| if (isset($_GET['page']) && $_GET['page'] == 'woo_discount_rules') { | |
| wp_deregister_script('bootstrap-datepicker'); | |
| } | |
| }, 100); |
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 - Dynamic Strikeout not Update during Add to Cart (Ajax) in Product page | |
| add_action('wp_footer', function () { | |
| if (function_exists('is_product') && is_product()) { | |
| ?> | |
| <script> | |
| jQuery(function($) { | |
| $(document.body).on('added_to_cart removed_from_cart wc_fragments_refreshed', function() { | |
| $('[name="quantity"]').trigger('change'); | |
| }); | |
| }); |
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 - Strikeout price issue | |
| add_filter('woocommerce_get_price_html', function ($price_html, $product){ | |
| global $post; | |
| $woo_uom_output = get_post_meta($post->ID, '_woo_uom_input', true); | |
| if ($woo_uom_output) { | |
| $content = '<span class="uom">' . esc_attr($woo_uom_output, 'woocommerce-uom') . '</span>'; | |
| $price_html = str_replace($content, '', $price_html); | |
| $price_html .= $content; | |
| } | |
| return $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
| // Change - load assets priority (increase to higher) | |
| add_action('advanced_woo_discount_rules_after_initialize', function() { | |
| if (class_exists('\Wdr\App\Router') && (!is_admin() || wp_doing_ajax())) { | |
| remove_action('wp_enqueue_scripts', array(\Wdr\App\Router::$manage_discount, 'loadAssets')); | |
| add_action('wp_enqueue_scripts', array(\Wdr\App\Router::$manage_discount, 'loadAssets'), 100000); | |
| } | |
| }); |
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 - BXGY Free Cart item quantity data getting (from JavaScript) issue | |
| add_action('woocommerce_cart_item_quantity', function($product_quantity, $cart_item_key, $cart_item) { | |
| if (is_numeric($product_quantity)) { | |
| $product_quantity = $product_quantity . ' ' . sprintf('<input type="hidden" name="cart[%s][qty]" value="%s" />', $cart_item_key, $product_quantity); | |
| } | |
| return $product_quantity; | |
| }, 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
| if (class_exists('\Wdr\App\Router')) { | |
| $applied_rule_ids = []; | |
| $manage_discount = \Wdr\App\Router::$manage_discount; | |
| $applied_rules = $manage_discount::$calculator::$applied_rules; | |
| if (!empty($applied_rules)) { | |
| foreach ($applied_rules as $rule) { | |
| $applied_rule_ids[] = (int) $rule->rule->id; | |
| } | |
| } | |
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 - Strikeout not shown correctly, same strikeout issues, etc. (may third party plugin prices not shown correctly) | |
| add_action('wp_loaded', function() { | |
| if(class_exists('\Wdr\App\Router')) { | |
| remove_all_filters('woocommerce_get_price_html'); | |
| remove_all_filters('woocommerce_variable_price_html'); | |
| add_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, 'getPriceHtmlSalePriceAdjustment'), 9, 2); | |
| add_filter('woocommerce_variable_price_html', array(\Wdr\App\Router::$manage_discount, 'getVariablePriceHtml'), 100, 2); | |
| } | |
| }, 100); |
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
| // Stop modify price html for guest role | |
| add_filter('advanced_woo_discount_rules_modify_price_html', function($modify, $price_html, $product, $quantity) { | |
| if (!is_user_logged_in()) { | |
| $modify = false; | |
| } | |
| return $modify; | |
| }, 100, 4); |