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_hidden_order_itemmeta', function ($arr){ | |
| $arr[] = '_Wcd_applied_discount_rules'; | |
| $arr[] = '_Wcd_applied_discount_amounts'; | |
| return $arr; | |
| }, 100, 1); |
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_filter('woocommerce_order_formatted_line_subtotal', array(\Wdr\App\Router::$manage_discount, 'orderSubTotalDiscountDetails'),1000); | |
| remove_action('woocommerce_get_formatted_order_total', array(\Wdr\App\Router::$manage_discount, 'displayTotalSavingsInOrderAfterOrderTotal')); | |
| } | |
| }, 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
| add_filter('advanced_woo_discount_rules_strikeout_price_html', function($html, $original_price, $discounted_price, $is_variable_product, $initial_price_html, $separator){ | |
| $initial_price_html = str_replace('<small class="woocommerce-price-suffix">inkl. MwSt.</small>', '', $initial_price_html); | |
| $html = '<del>'.$initial_price_html.'</del>'. $separator .'<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
| add_filter('advanced_woo_discount_rules_change_bulk_rule_quantity', function( $quantity, $cart_items, $product, $cart_quantity, $price_display_condition, $is_cart, $manual_request, $rule_id){ | |
| if($manual_request && $is_cart){ | |
| $quantity = ( $quantity == 1 ) ? 0 : (int) $quantity - 1 ; | |
| } | |
| return $quantity; | |
| }, 10, 8); |
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_dynamic_price_html_update', function($strikeout_html, $product, $initial_price, $discounted_price, $discount_details, $prices){ | |
| if ( get_option( 'wwpp_settings_wholesale_price_title_text' , false ) ){ | |
| if (function_exists('wp_get_current_user') && class_exists('\Wdr\App\Helpers\Woocommerce')) { | |
| $current_user = wp_get_current_user(); | |
| $current_user_roles = is_array( $current_user->roles ) ? $current_user->roles : array(); | |
| $product_id = \Wdr\App\Helpers\Woocommerce::getProductId($product); | |
| $wholesale_price = 0; | |
| if(isset($current_user_roles[0]) && !empty($current_user_roles[0])){ | |
| $wholesale_price = get_post_meta($product_id, $current_user_roles[0] . '_wholesale_price', true); | |
| if(!empty($wholesale_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_discounts_check_bogo_return_values', function($result, $buy_x_get_y_discount_data, $rule, $product, $cart_item, $ajax_price, $is_cart){ | |
| if(isset($buy_x_get_y_discount_data['rule_id']) && $buy_x_get_y_discount_data['rule_id'] != $rule->getId()){ | |
| return false; | |
| } | |
| return $result; | |
| }, 10, 7); |
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_get_price', function( $price, $product){ | |
| return wdrGetWholeSalePrice($price, $product); | |
| }, 10, 5); | |
| add_filter('advanced_woo_discount_rules_bulk_table_product_price', function($product_price, $product, $calculate_discount_from, $hasFilter, $filters){ | |
| return wdrGetWholeSalePrice($product_price, $product); | |
| }, 10, 5); | |
| add_filter('advanced_woo_discount_rules_get_regular_price', function( $price, $product){ | |
| return wdrGetWholeSalePrice($price, $product); |
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_category_taxonomies', function($taxonomy){ | |
| // Note: For attributes the taxonomy will be start with prefix pa_ | |
| // Example: For attribute Color the taxonomy will be pa_color | |
| $taxonomy[] = 'pa_color'; | |
| return $taxonomy; | |
| }, 10); | |
| add_filter('advanced_woo_discount_rules_get_product_categories', function ($categories, $product, $variant){ | |
| if(!empty($variant)){ |
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_discount_prices_of_product', function ($discount_prices, $product, $quantity, $cart_item){ | |
| //FOR CHANGING DISCOUNTED_PRICE you can change it in $discount_prices['discounted_price'] | |
| if(isset($discount_prices['discounted_price'])){ | |
| $discount_prices['discounted_price'] = wc_round_discount($discount_prices['discounted_price'], 1); | |
| } | |
| if(isset($discount_prices['discount_lines'])){ | |
| foreach ($discount_prices['discount_lines'] as $key => $value){ | |
| if($key !== 'non_applied'){ | |
| $line_discount = $discount_prices['discount_lines'][$key]['discounted_price']; | |
| $discount_prices['discount_lines'][$key]['discounted_price'] = wc_round_discount($line_discount, 1); |
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( class_exists('\Wdr\App\Helpers\Rule') ){ | |
| $coupon_code = ''; | |
| if (method_exists($coupon, 'get_code')) { | |
| $coupon_code = $coupon->get_code(); | |
| } | |
| $rule_helper = new \Wdr\App\Helpers\Rule(); | |
| $available_coupons = $rule_helper->getAllDynamicCoupons(); | |
| if (!empty($coupon_code) && in_array($coupon_code, $available_coupons)) { | |
| return "Load your message here!"; |