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('woo_discount_rules_exclude_product_from_discount', function($return, $product, $id, $rule, $cart_item){ | |
$priority_id = array(3); //Enter the priority id for which you need discount. i,e: array(1,2,3) | |
$category_id = array(22); //Enter the category id for which you need discount. i,e: array(1,2,3) | |
if(in_array($id,$priority_id)){ | |
if (method_exists($product, 'get_category_ids')) { | |
if ($product->is_type('variation')) { | |
if (method_exists($product, 'get_parent_id')) { | |
$parent_id = $product->get_parent_id(); | |
if(!empty($parent_id)){ | |
$product = wc_get_product($parent_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
<?php | |
/** | |
* List matched Rules in Table format | |
* | |
* This template can be overridden by copying it to yourtheme/plugin-folder-name/discount-table.php | |
*/ | |
if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
if (!isset($table_data) || empty($table_data)) return false; | |
$base_config = (is_string($data)) ? json_decode($data, true) : (is_array($data) ? $data : array()); | |
$show_discount_table_header = isset($base_config['show_discount_table_header']) ? $base_config['show_discount_table_header'] : 'show'; |
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
del .cont__price{ | |
text-decoration:line-through; | |
} |
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('woo_discount_rules_before_apply_discount_method')){ | |
function woo_discount_rules_before_apply_discount_method($amount, $product, $cart_item){ | |
if(isset($cart_item['_gform_total']) && !empty($cart_item['_gform_total'])){ | |
$addon_price = (int)$cart_item['_gform_total']; | |
$amount = isset($amount) && !empty($amount) ? (int)$amount : 0; | |
$total_amount = $amount+$addon_price; | |
return $total_amount; | |
} | |
return $amount; | |
} |
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('calculateProductPriceForWooDiscountRules')){ | |
function calculateProductPriceForWooDiscountRules($product_price, $product, $quantity, $cart_item, $calculate_discount_from){ | |
if ($calculate_discount_from == 'regular_price') { | |
if (method_exists($product, 'get_regular_price')) { | |
$product_price = $product->get_regular_price(); | |
} | |
} else { | |
if (method_exists($product, 'get_sale_price')) { | |
$product_price = $product->get_sale_price(); | |
} |
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_discounted_price_of_cart_item', function ($price, $cart_item, $cart_object, $calculated_cart_item_discount){ | |
if ( !empty( $cart_object->recurring_cart_key ) ) { | |
$product = isset($cart_item['data']) ? $cart_item['data'] : array(); | |
if(!empty($product)){ | |
if (method_exists($product, 'get_sale_price')) { | |
$price = $product->get_sale_price(); | |
} | |
if(empty($price)){ | |
if (method_exists($product, 'get_regular_price')) { | |
$price = $product->get_regular_price(); |
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_run_discount_rules', function($run_rule, $cart){ | |
return false; | |
}, 10, 2); | |
add_action( 'woocommerce_cart_loaded_from_session', function($cart){ | |
if ( sizeof( $cart->cart_contents ) > 0 ) { | |
foreach ( $cart->cart_contents as $cart_item_key => $cart_item ) { | |
$cart_key = isset($cart_item['key'])? $cart_item['key'] : ''; | |
$cart_item_data = isset($cart_item['data'])? $cart_item['data'] : ''; |
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('woo_discount_rules_sober_product_ribbons')) { | |
function woo_discount_rules_sober_product_ribbons($output, $product){ | |
if(empty($output['onsale'])){ | |
if ( $product->is_on_sale() ) { | |
$output['onsale'] = '<span class="onsale ribbon">Special Sale</span>'; | |
} | |
} else { | |
$product_id = $product->get_id(); | |
if(class_exists('\Wdr\App\Controllers\ManageDiscount')){ | |
$isProductOnSale = Wdr\App\Controllers\ManageDiscount::isProductOnSale($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('advanced_woo_discount_rules_format_sale_price_range', function($html, $min_price, $max_price){ | |
$html = wc_price($max_price); | |
return $html; | |
}, 10, 3); |
OlderNewer