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_omnibus_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 |
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_advance_table_based_on_rule', function ($advanced_layout, $rule, $discount_calculator, $product, $product_price, $html_content){ | |
// Check if the product is a variable product | |
if ( $product->is_type( 'variable' ) ) { | |
// Loop through each variation | |
foreach ( $product->get_children() as $variation_id ) { | |
$variation = wc_get_product( $variation_id ); | |
if ( ! $variation->is_in_stock() ) { | |
$advanced_layout = []; | |
break; |
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; | |
$applied_rules = \Wdr\App\Controllers\DiscountCalculator::$applied_rules; | |
foreach ($applied_rules as $rule) { | |
if($rule->rule->exclusive == 1){ | |
$applied_coupons = \Wdr\App\Helpers\Woocommerce::getAppliedCoupons(); | |
$exclude_coupons = ['shipfree']; //You can add the coupons here (with comma separate) | |
foreach ($applied_coupons as $applied_coupon) { | |
if (in_array($applied_coupon,$exclude_coupons)) { |
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_advance_table_based_on_rule', function ($advanced_layout, $rule, $discount_calculator, $product, $product_price, $html_content){ | |
if(!$product->is_in_stock()){ | |
$advanced_layout = []; | |
} | |
return $advanced_layout; | |
},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_strikeout_price_html', function ($html, $original_price, $discounted_price, $is_variable_product, $initial_price_html, $separator) { | |
if ($original_price != $discounted_price){ | |
$html = '<ins>' . $discounted_price . '</ins>'; | |
} | |
return $html; | |
},10,6); |