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_simple_product_id_by_custom', function(){ | |
| return '[name="add-to-cart"]'; | |
| }); | |
| add_filter( 'advanced_woo_discount_rules_custom_target_for_simple_product_on_qty_update', function(){ | |
| return 'div.product-information p.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_filter_passed', function($filter_passed, $rule, $product, $sale_badge){ | |
| //'array(339,340)' - give rule id as you needed | |
| if(in_array($rule->getId(),array(339,340)) && class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
| $rule_filter = $rule->getFilter(); | |
| $product_id = \Wdr\App\Helpers\Woocommerce::getProductId($product); | |
| $product_parent = \Wdr\App\Helpers\Woocommerce::getProductParentId($product_id); | |
| $product_id = !empty($product_parent) ? $product_parent : $product_id; | |
| $categories = \Wdr\App\Helpers\Woocommerce::getProductCategories($product); | |
| $category_id = array(); | |
| if($rule_filter){ |
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'){ | |
| $current_rule_id = isset($badge_settings['rule_id'])? $badge_settings['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
| add_filter('advanced_woo_discount_rules_get_price', function($price, $product){ | |
| $current_currency = apply_filters('wcml_price_currency', NULL ); | |
| if (method_exists($product, 'get_id')) { | |
| $product_id = $product->get_id(); | |
| } | |
| if (method_exists($product, 'is_type') && !empty($current_currency)) { | |
| $is_variable_product = $product->is_type('variable'); | |
| if($is_variable_product){ | |
| if (method_exists($product, 'get_available_variations') && method_exists($product, 'get_variation_default_attribute')) { | |
| $available_variations = $product->get_available_variations(); |
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_bulk_table_product_price', function($product_price, $product, $calculate_discount_from, $hasFilter, $filters){ | |
| if ($hasFilter && class_exists('\Wdr\App\Helpers\Woocommerce')) { | |
| $is_variable_product = \Wdr\App\Helpers\Woocommerce::productTypeIs($product, 'variable'); | |
| if ($is_variable_product) { | |
| foreach ($filters as $filter_val) { | |
| $filter_type = isset($filter_val->type) ? $filter_val->type : ''; | |
| $filter_method = isset($filter_val->method) ? $filter_val->method : ''; | |
| $filter_value = isset($filter_val->value) ? $filter_val->value : ''; | |
| $filter_product_variants = isset($filter_val->product_variants) ? $filter_val->product_variants : ''; | |
| if ($filter_type == 'products' && $filter_method == 'in_list') { |
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_format_sale_price_range', function( $html, $min_price, $max_price){ | |
| $min_price = number_format((float)$min_price, 2); | |
| $max_price = number_format((float)$max_price, 2); | |
| if (function_exists('wc_format_price_range')) { | |
| $html = wc_format_price_range($min_price, $max_price); | |
| } else{ | |
| if(class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
| $html = \Wdr\App\Helpers\Woocommerce::formatPrice($min_price) . ' - ' . \Wdr\App\Helpers\Woocommerce::formatPrice($max_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_filter_passed', function($filter_passed, $rule, $product, $sale_badge){ | |
| //'array(339,340)' - give rule id as you needed | |
| if(in_array($rule->getId(),array(398)) && class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
| $rule_filter = $rule->getFilter(); | |
| $product_id = \Wdr\App\Helpers\Woocommerce::getProductId($product); | |
| $product_parent = \Wdr\App\Helpers\Woocommerce::getProductParentId($product_id); | |
| $product_id = !empty($product_parent) ? $product_parent : $product_id; | |
| $categories = \Wdr\App\Helpers\Woocommerce::getProductCategories($product); | |
| $category_id = array(); | |
| if($rule_filter){ |
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){ | |
| $rule_array = array(1,2,3); //Include rule id here | |
| if($is_cart && in_array($rule_id, $rule_array)){ | |
| return $cart_quantity; | |
| } | |
| return $quantity; | |
| }, 8, 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_action( 'wp_head', function () { | |
| $currency_code = '$'; | |
| if(function_exists('get_woocommerce_currency_symbol')){ | |
| $currency_code = html_entity_decode(get_woocommerce_currency_symbol()); | |
| } | |
| ?> | |
| <script type="application/javascript"> | |
| (function ($) { | |
| $(document).ready(function ($) { | |
| var currency_string = '<?php echo $currency_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
| function modify_product_price($html, $original_price, $discounted_price){ | |
| $html .= ' + shipping from $9.50'; | |
| return $html; | |
| } | |
| add_filter( 'advanced_woo_discount_rules_strikeout_price_html', 'modify_product_price', 10, 3); |