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_do_recalculate_total', '__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
| add_filter('advanced_woo_discount_rules_line_item_subtotal', function($line_subtotal, $cart_item, $tax_display_type){ | |
| if(class_exists('Wdr\App\Controllers\Configuration')){ | |
| $product = isset($cart_item['data']) ? $cart_item['data'] : ''; | |
| $config = new Wdr\App\Controllers\Configuration(); | |
| if(!empty($product)){ | |
| $calculate_discount_from = $config->getConfig('calculate_discount_from', 'sale_price'); | |
| if($calculate_discount_from == 'sale_price'){ | |
| $price = $product->get_sale_price(); | |
| if(empty($price)){ | |
| $price = $product->get_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_action( 'woocommerce_cart_is_empty', function(){ | |
| if(class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
| $cart_items = \Wdr\App\Helpers\Woocommerce::getCart(); | |
| if(empty($cart_items)){ | |
| if (method_exists(WC()->cart, 'get_coupons')) { | |
| $get_coupons = WC()->cart->get_coupons(); | |
| if(!empty($get_coupons)){ | |
| foreach ( $get_coupons as $code => $coupon ){ | |
| if (method_exists(WC()->cart, 'remove_coupon')) { | |
| WC()->cart->remove_coupon( $code ); |
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 | |
| if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
| if (!empty($ranges) && !empty($woocommerce)) { | |
| if ($ranges['layout']['type'] == 'advanced') { | |
| $i=0; | |
| $existing_rule_id = 0; | |
| $tag_opened = false; | |
| foreach ($ranges as $key => $badge_settings){ | |
| if($key !== 'layout'){ |
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('plugins_loaded', function (){ | |
| if(class_exists('\Wdr\App\Router')){ | |
| remove_filter('advanced_woo_discount_rules_additional_fee_amount', array(\Wdr\App\Router::$manage_discount, 'applyTaxInFee')); | |
| } | |
| }); |
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){ | |
| if(is_object($rule)){ | |
| $rule_type = $rule->getRuleDiscountType(); | |
| $conditions = $rule->getConditions(); | |
| $filter_passed_user_logged_in = $user_logged_in_passed = $filter_passed_user_role = $filter_passed_user_list = $user_role_passed = $user_list_passed = $has_other_conditions = false; | |
| $condition_relationship = $rule->getRelationship('condition', 'and'); | |
| if(!empty($conditions) && $filter_passed && $rule_type == 'wdr_buy_x_get_y_discount'){ | |
| foreach($conditions as $condition){ | |
| $cart = array(); | |
| $options = isset($condition->options) ? $condition->options : array(); |
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_coupon_error', function($err, $err_code, $coupon){ | |
| if(is_object($coupon) && method_exists($coupon, 'get_code')){ | |
| if( in_array($coupon->get_code(), array('black friday', 'cyber monday'))){ | |
| $err = ''; | |
| } | |
| } | |
| return $err; | |
| }, 30, 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(1,2)) && class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
| $rule_filter = $rule->getFilter(); | |
| $categories = \Wdr\App\Helpers\Woocommerce::getProductCategories($product); | |
| $first_category_id = array(); | |
| $second_category_id = array(); | |
| if($rule_filter){ | |
| foreach($rule_filter as $filter){ | |
| $type = isset($filter->type) ? $filter->type : ''; |
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( 'wp_footer', function(){?> | |
| <script type="text/javascript"> | |
| (function ($) { | |
| $(document).ready(function ($) { | |
| function awdr_load_variation_table_customized(variation_id){ | |
| setTimeout(function(){ | |
| if(variation_id != '' && variation_id != '0'){ | |
| var data = { | |
| action: 'wdr_ajax', | |
| method: 'get_variable_product_bulk_table', |
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('plugins_loaded', function (){ | |
| if(class_exists('\Wdr\App\Router')){ | |
| remove_action('woocommerce_cart_totals_order_total_html', array(\Wdr\App\Router::$manage_discount, 'getCartTotalPriceHtml')); | |
| add_action('woocommerce_cart_totals_order_total_html', array(\Wdr\App\Router::$manage_discount, 'getCartTotalPriceHtml'), 9999, 1); | |
| } | |
| }, 11); |