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) { | |
global $product; | |
if ($is_variable_product && !empty($product) && is_object($product)) { | |
foreach ($product->get_available_variations() as $variation) { | |
$default_attributes = true; | |
foreach ($product->get_default_attributes() as $default_key => $default_value) { | |
if ($variation['attributes']['attribute_' . $default_key] != $default_value) { | |
$default_attributes = false; | |
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_filter('advanced_woo_discount_rules_strikeout_price_html', function ($html, $original_price, $discounted_price, $is_variable_product, $initial_price_html, $separator) { | |
global $product; | |
if ($is_variable_product && !empty($product) && is_object($product)) { | |
foreach ($product->get_available_variations() as $variation) { | |
$default_attributes = true; | |
foreach ($product->get_default_attributes() as $default_key => $default_value) { | |
if ($variation['attributes']['attribute_' . $default_key] != $default_value) { | |
$default_attributes = false; | |
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_filter('advanced_woo_discount_rules_discount_prices_of_product', function ($discount_prices, $product, $quantity, $cart_item){ | |
if (function_exists('wc_get_price_decimals')) { | |
$precision = 1; | |
if(isset($discount_prices['discounted_price'])){ | |
$discount_prices['discounted_price'] = round($discount_prices['discounted_price'], $precision); | |
} | |
if(isset($discount_prices['discounted_price_with_tax'])){ | |
$discount_prices['discounted_price_with_tax'] = round($discount_prices['discounted_price_with_tax'], $precision); | |
} | |
if(isset($discount_prices['discount_lines'])){ |
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('wp_head', function() { | |
if(!is_single()){ | |
?> | |
<style>.awdr-bulk-customizable-table{display:none}</style> | |
<?php | |
} | |
}); |
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('woocommerce_sale_flash', function ($html, $post, $_product) { | |
return '<span class="sale" style="background-color:#ddd;">Aktion!</span>'; | |
},10,3); |
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('wc_add_to_cart_message_html', function ($message, $products, $show_qty){ | |
foreach ( $products as $product_id => $qty ) { | |
$product = wc_get_product( $product_id); | |
$product_price = $product->get_price(); | |
$discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $product_price, $product, $qty, $product_price, 'discounted_price', false, true); | |
if($discount !== false) { | |
$message .= " Discounted price: ". $discount; //HERE YOU GET DISCOUNTED PRICE | |
} | |
} | |
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_strikeout_price_html', function ($html, $original_price, $discounted_price, $is_variable_product, $initial_price_html, $separator, $original_price_raw, $discounted_price_raw) { | |
if ($original_price != $discounted_price) { | |
if ($initial_price_html) { | |
$html = '<ins>' . $discounted_price . '</ins>' . $separator . '<del>' . $initial_price_html . '</del>'; | |
} else { | |
$html = '<ins>' . $discounted_price . '</ins>' . $separator . '<del>' . $original_price . '</del>'; | |
} | |
$percentage = 0; | |
if(!$is_variable_product){ | |
if($original_price_raw >0) |
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 | |
/** | |
* Product loop sale flash | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/loop/sale-flash.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and |
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('admin_menu', function () { | |
if (!is_admin()) return; | |
if(class_exists('\Wdr\App\Router')){ | |
$admin = \Wdr\App\Router::$admin; | |
global $submenu; | |
add_submenu_page( | |
'woocommerce', | |
__('Woo Discount Rules', 'woo-discount-rules'), | |
__('Woo Discount Rules', 'woo-discount-rules'), | |
'manage_woocommerce', WDR_SLUG, |
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('awdrcheckParentCategory')){ | |
function awdrcheckParentCategory ($categories){ | |
foreach($categories as $id) { | |
if ($term = get_term($id)) { | |
if ($parent_id = $term->parent) { | |
if (!in_array($parent_id, $categories)) { | |
$categories = array_merge($categories, awdrcheckParentCategory(array($parent_id))); | |
} | |
} | |
} |
OlderNewer