This file contains 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_calculate_discount_for_cart_item', '__return_false'); |
This file contains 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_before_cart', function () { | |
if (class_exists('\WDR\App\Controllers\DiscountCalculator') && class_exists('\WDRPro\App\Rules\Cheapest')) { | |
$cart = WC()->cart; | |
$cart_items = $cart->get_cart(); | |
$applied_rules = \WDR\App\Controllers\DiscountCalculator::$applied_rules; | |
if (!empty($applied_rules)) { | |
$product_count = 0; | |
foreach ($applied_rules as $applied_rule) { | |
if ($applied_rule->rule->discount_type == 'wdr_buy_x_get_y_discount') { | |
foreach ($cart_items as $cart_item_key => $cart_item) { |
This file contains 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, $product_table, $conditionFailed) { | |
if(is_object($product) && method_exists($product, 'is_on_backorder')){ | |
if($product->is_on_backorder()){ | |
return false; | |
} | |
} | |
return $filter_passed; | |
}, 10, 6); |
This file contains 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_product_price_on_before_calculate_discount', function($product_price, $product, $quantity, $cart_item){ | |
global $awdr_addon_commpatible_products; | |
if(!empty($cart_item)){ | |
if (method_exists($product, 'get_id') && function_exists('wc_get_product')) { | |
$product_id = $product->get_id(); | |
if(isset($awdr_addon_commpatible_products[$product_id])){ | |
$product = $awdr_addon_commpatible_products[$product_id]; | |
} else { | |
$awdr_addon_commpatible_products[$product_id] = $product = wc_get_product($product_id); | |
} |
This file contains 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('wdr_omnibus_directive_separate_get_price_html_message', function ($message, $min_price, $lowest_price_date) { | |
global $product; | |
if (is_object($product)){ | |
$sale_price = $product->get_price(); | |
$discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $sale_price, $product, 1, 0, 'discounted_price', true, false); | |
if($discount === false) { | |
return ''; | |
} | |
} | |
return $message; |
This file contains 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_custom_taxonomies', function($custom_taxonomies) { | |
if (function_exists('get_taxonomies')) { | |
$custom_taxonomies = array_filter(get_taxonomies(array( | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'object_type' => array('product','ethosstore'), | |
), 'objects'), function ($tax) { | |
return !in_array($tax->name, array('product_cat', 'product_tag')); | |
}); | |
} |
This file contains 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 ( ! function_exists( 'pricom_child_product_label' ) ) { | |
function pricom_child_product_label() { | |
global $product; | |
$output = array(); | |
$product_new = get_post_meta( get_the_ID(), 'haru_product_new', true ); | |
$product_hot = get_post_meta( get_the_ID(), 'haru_product_hot', true ); | |
if (is_object($product)) { | |
$percentage = ''; |
This file contains 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_updated', function() { | |
if (function_exists('WC') && WC()->cart->is_empty()) { | |
// Clear coupon session data | |
WC()->session->set('applied_coupons', array()); | |
} | |
}); |
This file contains 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_before_cart', function(){ | |
if(class_exists('\Wdr\App\Router') && class_exists('\Wdr\App\Controllers\DiscountCalculator') && class_exists('\Wdr\App\Helpers\Woocommerce')){ | |
$manage_discount = \Wdr\App\Router::$manage_discount; | |
$calculator = $manage_discount::$calculator; | |
$used_coupons = $calculator::getUsedCoupons(); | |
$applied_coupons = \Wdr\App\Helpers\Woocommerce::getAppliedCoupons(); | |
foreach ($applied_coupons as $applied_coupon) { | |
if (in_array($applied_coupon,$used_coupons)) { | |
$coupon = new WC_Coupon($applied_coupon); | |
// Check if the coupon has zero value |
NewerOlder