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_modify_price_html', function($result, $price_html, $product, $quantity){ | |
// is_page( 'cart' ) -> cart is a page slug | |
if ( is_page( 'cart' ) || is_cart() ) { | |
return false; | |
} | |
return $result; | |
}, 10, 4); |
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){ | |
if($is_variable_product){ | |
return "From: " .str_replace("<br>", ' ', $html); | |
} else { | |
return $html; | |
} | |
}, 10, 4); | |
add_filter('advanced_woo_discount_rules_format_sale_price_range', function($html, $min_price, $max_price, $original_html){ | |
return wc_price($min_price); | |
}, 10, 4); |
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 | |
/** | |
* Auto add variation option | |
* | |
* This template can be overridden by copying it to yourtheme/woo-discount-rules-pro/buy-x-get-y-select-auto-add-variant.php. | |
* | |
*/ | |
if (!defined('ABSPATH')) { | |
exit; // Exit if accessed directly | |
} |
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 ((isset($_REQUEST['wc-ajax']) && ($_REQUEST['wc-ajax'] == 'add_to_cart' || $_REQUEST['wc-ajax'] == 'remove_from_cart')) || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'woodmart_ajax_add_to_cart')) { | |
add_action('woocommerce_mini_cart_contents', function (){ | |
if (!WC()->cart->is_empty()){ | |
WC()->cart->calculate_totals(); | |
} | |
}); | |
} |
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_on_sale_badge_html', function ($html, $post, $_product){ | |
if (strpos($html, 'Sale!') !== false) { | |
$percentage = 0; | |
$reg_p = floatval( $_product->get_regular_price() ); | |
$sale_p = floatval( $_product->get_sale_price() ); | |
if ( $reg_p && $sale_p) { | |
$percentage = - round( ( ( $reg_p - $sale_p ) / $reg_p ) * 100 ); | |
} elseif ( 'variable' == $_product->get_type() && $_product->get_variation_regular_price() && $_product->get_variation_sale_price() ) { | |
$percentage = - round( ( ( $_product->get_variation_regular_price() - $_product->get_variation_sale_price() ) / $_product->get_variation_regular_price() ) * 100 ); | |
} |
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_cheapest_discount', function ($process, $rule, $cart_item, $is_cart){ | |
if(function_exists('is_cart')){ | |
if(is_cart() && !$is_cart){ | |
$process = false; | |
} | |
} | |
return $process; | |
}, 10, 4); |
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 | |
* | |
* @version 1.6.4 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} |
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('advanced_woo_discount_rules_after_initialize', function() { | |
if(class_exists('\Wdr\App\Router')){ | |
remove_filter('woocommerce_variable_price_html', array(\Wdr\App\Router::$manage_discount, 'getVariablePriceHtml'), 100); | |
add_filter('woocommerce_variable_price_html', array(\Wdr\App\Router::$manage_discount, 'getVariablePriceHtml'), 10000, 2); | |
} | |
}); | |
add_filter('advanced_woo_discount_rules_strikeout_price_html', function($html, $original_price, $discounted_price, $is_variable_product){ | |
if($is_variable_product){ | |
return "Fr: " .str_replace("<br>", ' ', $html); | |
} else { |
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('advanced_woo_discount_rules_after_initialize', function() { | |
if(class_exists('\Wdr\App\Router')){ | |
remove_filter('woocommerce_variable_price_html', array(\Wdr\App\Router::$manage_discount, 'getVariablePriceHtml'), 100); | |
add_filter('woocommerce_variable_price_html', array(\Wdr\App\Router::$manage_discount, 'getVariablePriceHtml'), 1000, 2); | |
} | |
}); |