Version Description
- 30/07/19 =
- Feature - Force override the label for sale badge option.
- Fix - Include child variants while parent is chosen in product dependent rule.
- Fix - Wrong strike-out for product dependent rule on skip first option is chosen.
- Fix - Wrong strike-out for variable product on apply discount apply based on regular price.
- Fix - Get free product price from cart line item instead of loading original product (BOGO cart rule).
- Improvement - Performance on having more items in cart.
- Improvement - Event apply_filters('woo_discount_rules_variation_is_visible', $visible, $product).
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.7.18 |
Comparing to | |
See all releases |
Code changes from version 1.7.17 to 1.7.18
- assets/js/app.js +10 -0
- helper/woo-function.php +3 -2
- i18n/languages/woo-discount-rules.pot +41 -30
- includes/cart-rules.php +6 -6
- includes/discount-base.php +107 -0
- includes/pricing-rules.php +75 -15
- loader.php +7 -0
- readme.txt +22 -7
- view/settings_general.php +4 -4
- view/settings_price_rules.php +3 -0
- view/template/loop/sale-flash.php +27 -0
- view/template/single-product/sale-flash.php +27 -0
- woo-discount-rules.php +1 -1
assets/js/app.js
CHANGED
@@ -1077,6 +1077,11 @@ function trigger_woocommerce_tooltip(){
|
|
1077 |
var form = $('#discount_config').serialize();
|
1078 |
var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
|
1079 |
current.val(woo_discount_localization.saving);
|
|
|
|
|
|
|
|
|
|
|
1080 |
$.ajax({
|
1081 |
url: ajax_url,
|
1082 |
type: 'POST',
|
@@ -1091,6 +1096,11 @@ function trigger_woocommerce_tooltip(){
|
|
1091 |
// After Removed.
|
1092 |
resizeChart = setTimeout(function () {
|
1093 |
current.val(woo_discount_localization.save_text);
|
|
|
|
|
|
|
|
|
|
|
1094 |
}, 300);
|
1095 |
adminNotice();
|
1096 |
}
|
1077 |
var form = $('#discount_config').serialize();
|
1078 |
var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
|
1079 |
current.val(woo_discount_localization.saving);
|
1080 |
+
if(type == 'settings'){
|
1081 |
+
var enable_bootstrap_pre_val = $('#enable_bootstrap_id').attr('data-val');
|
1082 |
+
var enable_bootstrap_current_val = $('input[name="enable_bootstrap"]:checked').val();
|
1083 |
+
}
|
1084 |
+
|
1085 |
$.ajax({
|
1086 |
url: ajax_url,
|
1087 |
type: 'POST',
|
1096 |
// After Removed.
|
1097 |
resizeChart = setTimeout(function () {
|
1098 |
current.val(woo_discount_localization.save_text);
|
1099 |
+
if(type == 'settings'){
|
1100 |
+
if(enable_bootstrap_pre_val != enable_bootstrap_current_val){
|
1101 |
+
location.reload();
|
1102 |
+
}
|
1103 |
+
}
|
1104 |
}, 300);
|
1105 |
adminNotice();
|
1106 |
}
|
helper/woo-function.php
CHANGED
@@ -364,11 +364,12 @@ if(!class_exists('FlycartWoocommerceProduct')){
|
|
364 |
*/
|
365 |
public static function variation_is_visible_in_frontend($product)
|
366 |
{
|
|
|
367 |
if(method_exists($product, 'variation_is_visible')){
|
368 |
-
|
369 |
}
|
370 |
|
371 |
-
return
|
372 |
}
|
373 |
|
374 |
/**
|
364 |
*/
|
365 |
public static function variation_is_visible_in_frontend($product)
|
366 |
{
|
367 |
+
$visible = true;
|
368 |
if(method_exists($product, 'variation_is_visible')){
|
369 |
+
$visible = $product->variation_is_visible();
|
370 |
}
|
371 |
|
372 |
+
return apply_filters('woo_discount_rules_variation_is_visible', $visible, $product);
|
373 |
}
|
374 |
|
375 |
/**
|
i18n/languages/woo-discount-rules.pot
CHANGED
@@ -103,11 +103,11 @@ msgstr ""
|
|
103 |
msgid "License key seems to be Invalid. Please enter a valid license key"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: helper/woo-function.php:
|
107 |
msgid "Search for a product…"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: helper/woo-function.php:
|
111 |
msgid "Search for a user…"
|
112 |
msgstr ""
|
113 |
|
@@ -643,92 +643,92 @@ msgstr ""
|
|
643 |
msgid "Settings"
|
644 |
msgstr ""
|
645 |
|
646 |
-
#: includes/pricing-rules.php:
|
647 |
msgid "Buy"
|
648 |
msgstr ""
|
649 |
|
650 |
-
#: includes/pricing-rules.php:
|
651 |
msgid " less than or equal to "
|
652 |
msgstr ""
|
653 |
|
654 |
-
#: includes/pricing-rules.php:
|
655 |
msgid " Quantity"
|
656 |
msgstr ""
|
657 |
|
658 |
-
#: includes/pricing-rules.php:
|
659 |
msgid " Quantity "
|
660 |
msgstr ""
|
661 |
|
662 |
-
#: includes/pricing-rules.php:
|
663 |
msgid " or more Quantity"
|
664 |
msgstr ""
|
665 |
|
666 |
-
#: includes/pricing-rules.php:
|
667 |
msgid " any "
|
668 |
msgstr ""
|
669 |
|
670 |
-
#: includes/pricing-rules.php:
|
671 |
msgid " products from "
|
672 |
msgstr ""
|
673 |
|
674 |
-
#: includes/pricing-rules.php:
|
675 |
msgid " in each products"
|
676 |
msgstr ""
|
677 |
|
678 |
-
#: includes/pricing-rules.php:
|
679 |
msgid " and get discount in "
|
680 |
msgstr ""
|
681 |
|
682 |
-
#: includes/pricing-rules.php:
|
683 |
msgid " first "
|
684 |
msgstr ""
|
685 |
|
686 |
-
#: includes/pricing-rules.php:
|
687 |
msgid " quantity of product(s) - "
|
688 |
msgstr ""
|
689 |
|
690 |
-
#: includes/pricing-rules.php:
|
691 |
msgid " after first "
|
692 |
msgstr ""
|
693 |
|
694 |
-
#: includes/pricing-rules.php:
|
695 |
msgid "Category(ies) "
|
696 |
msgstr ""
|
697 |
|
698 |
-
#: includes/pricing-rules.php:
|
699 |
msgid "Get "
|
700 |
msgstr ""
|
701 |
|
702 |
-
#: includes/pricing-rules.php:
|
703 |
#, php-format
|
704 |
msgid "% discount in "
|
705 |
msgstr ""
|
706 |
|
707 |
-
#: includes/pricing-rules.php:
|
708 |
msgid "same product"
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: includes/pricing-rules.php:
|
712 |
msgid "any cheapest one from cart"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: includes/pricing-rules.php:
|
716 |
msgid "any cheapest one of "
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: includes/pricing-rules.php:
|
720 |
msgid " quantity of any "
|
721 |
msgstr ""
|
722 |
|
723 |
-
#: includes/pricing-rules.php:
|
724 |
msgid " cheapest item "
|
725 |
msgstr ""
|
726 |
|
727 |
-
#: includes/pricing-rules.php:
|
728 |
msgid " quantity of cheapest item "
|
729 |
msgstr ""
|
730 |
|
731 |
-
#: includes/pricing-rules.php:
|
732 |
msgid "from the category "
|
733 |
msgstr ""
|
734 |
|
@@ -1058,7 +1058,7 @@ msgstr ""
|
|
1058 |
msgid "Enable free shipping option"
|
1059 |
msgstr ""
|
1060 |
|
1061 |
-
#: view/settings_cart_rules.php:92 view/settings_price_rules.php:
|
1062 |
#: view/view-pricing-rules.php:300 view/view-pricing-rules.php:357
|
1063 |
#: view/view-pricing-rules.php:427 view/view-pricing-rules.php:475
|
1064 |
#: view/view-pricing-rules.php:504
|
@@ -1304,25 +1304,31 @@ msgid ""
|
|
1304 |
"plugin"
|
1305 |
msgstr ""
|
1306 |
|
1307 |
-
#: view/settings_price_rules.php:
|
1308 |
msgid "Do you want to customize the sale badge?"
|
1309 |
msgstr ""
|
1310 |
|
1311 |
-
#: view/settings_price_rules.php:
|
1312 |
msgid "Yes, I would like to customize the sale badge"
|
1313 |
msgstr ""
|
1314 |
|
1315 |
-
#: view/settings_price_rules.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
1316 |
msgid "Sale badge content (TIP: You can use HTML inside)"
|
1317 |
msgstr ""
|
1318 |
|
1319 |
-
#: view/settings_price_rules.php:
|
1320 |
msgid ""
|
1321 |
"IMPORTANT NOTE: This customized sale badge will be applicable only for "
|
1322 |
"products that are part of the discount rules configured in this plugin"
|
1323 |
msgstr ""
|
1324 |
|
1325 |
-
#: view/settings_price_rules.php:
|
1326 |
msgid "Eg:"
|
1327 |
msgstr ""
|
1328 |
|
@@ -1395,6 +1401,11 @@ msgstr ""
|
|
1395 |
msgid "No Active Discounts."
|
1396 |
msgstr ""
|
1397 |
|
|
|
|
|
|
|
|
|
|
|
1398 |
#: view/template/sidebar.php:7
|
1399 |
msgid "Looking for more features? Upgrade to PRO"
|
1400 |
msgstr ""
|
103 |
msgid "License key seems to be Invalid. Please enter a valid license key"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: helper/woo-function.php:442 helper/woo-function.php:452
|
107 |
msgid "Search for a product…"
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: helper/woo-function.php:485 helper/woo-function.php:497
|
111 |
msgid "Search for a user…"
|
112 |
msgstr ""
|
113 |
|
643 |
msgid "Settings"
|
644 |
msgstr ""
|
645 |
|
646 |
+
#: includes/pricing-rules.php:2836 view/view-pricing-rules.php:568
|
647 |
msgid "Buy"
|
648 |
msgstr ""
|
649 |
|
650 |
+
#: includes/pricing-rules.php:2840
|
651 |
msgid " less than or equal to "
|
652 |
msgstr ""
|
653 |
|
654 |
+
#: includes/pricing-rules.php:2840 includes/pricing-rules.php:2846
|
655 |
msgid " Quantity"
|
656 |
msgstr ""
|
657 |
|
658 |
+
#: includes/pricing-rules.php:2843
|
659 |
msgid " Quantity "
|
660 |
msgstr ""
|
661 |
|
662 |
+
#: includes/pricing-rules.php:2850
|
663 |
msgid " or more Quantity"
|
664 |
msgstr ""
|
665 |
|
666 |
+
#: includes/pricing-rules.php:2859
|
667 |
msgid " any "
|
668 |
msgstr ""
|
669 |
|
670 |
+
#: includes/pricing-rules.php:2859
|
671 |
msgid " products from "
|
672 |
msgstr ""
|
673 |
|
674 |
+
#: includes/pricing-rules.php:2866
|
675 |
msgid " in each products"
|
676 |
msgstr ""
|
677 |
|
678 |
+
#: includes/pricing-rules.php:2878
|
679 |
msgid " and get discount in "
|
680 |
msgstr ""
|
681 |
|
682 |
+
#: includes/pricing-rules.php:2881
|
683 |
msgid " first "
|
684 |
msgstr ""
|
685 |
|
686 |
+
#: includes/pricing-rules.php:2883 includes/pricing-rules.php:2887
|
687 |
msgid " quantity of product(s) - "
|
688 |
msgstr ""
|
689 |
|
690 |
+
#: includes/pricing-rules.php:2885
|
691 |
msgid " after first "
|
692 |
msgstr ""
|
693 |
|
694 |
+
#: includes/pricing-rules.php:2903
|
695 |
msgid "Category(ies) "
|
696 |
msgstr ""
|
697 |
|
698 |
+
#: includes/pricing-rules.php:2971
|
699 |
msgid "Get "
|
700 |
msgstr ""
|
701 |
|
702 |
+
#: includes/pricing-rules.php:2973
|
703 |
#, php-format
|
704 |
msgid "% discount in "
|
705 |
msgstr ""
|
706 |
|
707 |
+
#: includes/pricing-rules.php:2976
|
708 |
msgid "same product"
|
709 |
msgstr ""
|
710 |
|
711 |
+
#: includes/pricing-rules.php:2978
|
712 |
msgid "any cheapest one from cart"
|
713 |
msgstr ""
|
714 |
|
715 |
+
#: includes/pricing-rules.php:2981
|
716 |
msgid "any cheapest one of "
|
717 |
msgstr ""
|
718 |
|
719 |
+
#: includes/pricing-rules.php:2986
|
720 |
msgid " quantity of any "
|
721 |
msgstr ""
|
722 |
|
723 |
+
#: includes/pricing-rules.php:2988
|
724 |
msgid " cheapest item "
|
725 |
msgstr ""
|
726 |
|
727 |
+
#: includes/pricing-rules.php:2991
|
728 |
msgid " quantity of cheapest item "
|
729 |
msgstr ""
|
730 |
|
731 |
+
#: includes/pricing-rules.php:2995
|
732 |
msgid "from the category "
|
733 |
msgstr ""
|
734 |
|
1058 |
msgid "Enable free shipping option"
|
1059 |
msgstr ""
|
1060 |
|
1061 |
+
#: view/settings_cart_rules.php:92 view/settings_price_rules.php:307
|
1062 |
#: view/view-pricing-rules.php:300 view/view-pricing-rules.php:357
|
1063 |
#: view/view-pricing-rules.php:427 view/view-pricing-rules.php:475
|
1064 |
#: view/view-pricing-rules.php:504
|
1304 |
"plugin"
|
1305 |
msgstr ""
|
1306 |
|
1307 |
+
#: view/settings_price_rules.php:295
|
1308 |
msgid "Do you want to customize the sale badge?"
|
1309 |
msgstr ""
|
1310 |
|
1311 |
+
#: view/settings_price_rules.php:302
|
1312 |
msgid "Yes, I would like to customize the sale badge"
|
1313 |
msgstr ""
|
1314 |
|
1315 |
+
#: view/settings_price_rules.php:304
|
1316 |
+
msgid ""
|
1317 |
+
"Force override the label for sale badge (useful when your theme has override "
|
1318 |
+
"for sale badge)."
|
1319 |
+
msgstr ""
|
1320 |
+
|
1321 |
+
#: view/settings_price_rules.php:319
|
1322 |
msgid "Sale badge content (TIP: You can use HTML inside)"
|
1323 |
msgstr ""
|
1324 |
|
1325 |
+
#: view/settings_price_rules.php:326
|
1326 |
msgid ""
|
1327 |
"IMPORTANT NOTE: This customized sale badge will be applicable only for "
|
1328 |
"products that are part of the discount rules configured in this plugin"
|
1329 |
msgstr ""
|
1330 |
|
1331 |
+
#: view/settings_price_rules.php:330
|
1332 |
msgid "Eg:"
|
1333 |
msgstr ""
|
1334 |
|
1401 |
msgid "No Active Discounts."
|
1402 |
msgstr ""
|
1403 |
|
1404 |
+
#: view/template/loop/sale-flash.php:23
|
1405 |
+
#: view/template/single-product/sale-flash.php:23
|
1406 |
+
msgid "Sale!"
|
1407 |
+
msgstr ""
|
1408 |
+
|
1409 |
#: view/template/sidebar.php:7
|
1410 |
msgid "Looking for more features? Upgrade to PRO"
|
1411 |
msgstr ""
|
includes/cart-rules.php
CHANGED
@@ -794,7 +794,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
|
|
794 |
}
|
795 |
}
|
796 |
} else if($cart_setup == 'biggest'){
|
797 |
-
$biggestDiscount = 0;
|
798 |
// Processing the Totals.
|
799 |
foreach ($this->rule_sets as $index => $rule) {
|
800 |
if ($rule['enabled'] == true) {
|
@@ -1800,11 +1800,11 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
|
|
1800 |
foreach ($products as $discounted_product_id) {
|
1801 |
if(array_key_exists($discounted_product_id,$cart))
|
1802 |
{
|
1803 |
-
$
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
}
|
1809 |
}
|
1810 |
}
|
794 |
}
|
795 |
}
|
796 |
} else if($cart_setup == 'biggest'){
|
797 |
+
$biggestDiscount = $newDiscount = 0;
|
798 |
// Processing the Totals.
|
799 |
foreach ($this->rule_sets as $index => $rule) {
|
800 |
if ($rule['enabled'] == true) {
|
1800 |
foreach ($products as $discounted_product_id) {
|
1801 |
if(array_key_exists($discounted_product_id,$cart))
|
1802 |
{
|
1803 |
+
if(isset($cart[$discounted_product_id]['price'])){
|
1804 |
+
$free_line_item += 1;
|
1805 |
+
$free_quantity += $rule_discount_quantity;
|
1806 |
+
$free_item_price += $cart[$discounted_product_id]['price'];
|
1807 |
+
}
|
1808 |
}
|
1809 |
}
|
1810 |
}
|
includes/discount-base.php
CHANGED
@@ -1175,5 +1175,112 @@ if (!class_exists('FlycartWooDiscountBase')) {
|
|
1175 |
);
|
1176 |
return array_merge( $links, $mewlinks );
|
1177 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1178 |
}
|
1179 |
}
|
1175 |
);
|
1176 |
return array_merge( $links, $mewlinks );
|
1177 |
}
|
1178 |
+
|
1179 |
+
/**
|
1180 |
+
* Remove hooks set by other plugins
|
1181 |
+
* */
|
1182 |
+
public static function removeHooksSetByOtherPlugins() {
|
1183 |
+
global $wp_filter;
|
1184 |
+
|
1185 |
+
$allowed_hooks = array(
|
1186 |
+
//Filters
|
1187 |
+
"woocommerce_sale_flash" => array( "FlycartWooDiscountRulesPricingRules|replaceSaleTagText" ),
|
1188 |
+
);
|
1189 |
+
|
1190 |
+
foreach ( $wp_filter as $hook_name => $hook_obj ) {
|
1191 |
+
if ( preg_match( '#^woocommerce_#', $hook_name ) ) {
|
1192 |
+
if ( isset( $allowed_hooks[ $hook_name ] ) ) {
|
1193 |
+
$wp_filter[ $hook_name ] = self::remove_wrong_callbacks( $hook_obj, $allowed_hooks[ $hook_name ] );
|
1194 |
+
} else {
|
1195 |
+
}
|
1196 |
+
}
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
/**
|
1201 |
+
* Remove other plugin hooks
|
1202 |
+
*
|
1203 |
+
* @param $hook_obj object
|
1204 |
+
* @param $allowed_hooks string
|
1205 |
+
* @return string
|
1206 |
+
* */
|
1207 |
+
public static function remove_wrong_callbacks( $hook_obj, $allowed_hooks ) {
|
1208 |
+
$new_callbacks = array();
|
1209 |
+
foreach ( $hook_obj->callbacks as $priority => $callbacks ) {
|
1210 |
+
$priority_callbacks = array();
|
1211 |
+
foreach ( $callbacks as $idx => $callback_details ) {
|
1212 |
+
if ( self::is_callback_match( $callback_details, $allowed_hooks ) ) {
|
1213 |
+
$priority_callbacks[ $idx ] = $callback_details;
|
1214 |
+
}
|
1215 |
+
}
|
1216 |
+
if ( $priority_callbacks ) {
|
1217 |
+
$new_callbacks[ $priority ] = $priority_callbacks;
|
1218 |
+
}
|
1219 |
+
}
|
1220 |
+
$hook_obj->callbacks = $new_callbacks;
|
1221 |
+
|
1222 |
+
return $hook_obj;
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
/**
|
1226 |
+
* Is hook matches
|
1227 |
+
*
|
1228 |
+
* @param $callback_details array
|
1229 |
+
* @param $allowed_hooks array
|
1230 |
+
* @return boolean
|
1231 |
+
* */
|
1232 |
+
public static function is_callback_match( $callback_details, $allowed_hooks ) {
|
1233 |
+
$result = false;
|
1234 |
+
foreach ( $allowed_hooks as $callback_name ) {
|
1235 |
+
list( $class_name, $func_name ) = explode( "|", $callback_name );
|
1236 |
+
if(isset($callback_details['function']) && is_array($callback_details['function'])){
|
1237 |
+
if ( count( $callback_details['function'] ) != 2 ) {
|
1238 |
+
continue;
|
1239 |
+
}
|
1240 |
+
if ( $class_name == get_class( $callback_details['function'][0] ) AND $func_name == $callback_details['function'][1] ) {
|
1241 |
+
$result = true;
|
1242 |
+
break;// done!
|
1243 |
+
}
|
1244 |
+
}
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
return $result;
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
/**
|
1251 |
+
* Change the default template for sale badge
|
1252 |
+
*
|
1253 |
+
* @param $located string
|
1254 |
+
* @param $template_name string
|
1255 |
+
* @param $args array
|
1256 |
+
* @param $template_path string
|
1257 |
+
* @param $default_path string
|
1258 |
+
* @return string
|
1259 |
+
* */
|
1260 |
+
public static function changeTemplateForSaleTag($located, $template_name, $args, $template_path, $default_path){
|
1261 |
+
if($template_name == 'single-product/sale-flash.php'){
|
1262 |
+
$located = self::getTemplatePath('sale-flash.php', WOO_DISCOUNT_DIR . '/view/template/single-product/sale-flash.php', 'single-product');
|
1263 |
+
} else if($template_name == 'loop/sale-flash.php'){
|
1264 |
+
$located = self::getTemplatePath('sale-flash.php', WOO_DISCOUNT_DIR . '/view/template/loop/sale-flash.php', 'loop');
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
return $located;
|
1268 |
+
}
|
1269 |
+
|
1270 |
+
/**
|
1271 |
+
* Get template path
|
1272 |
+
*
|
1273 |
+
* @param $template_name string
|
1274 |
+
* @param $default_path string
|
1275 |
+
* @param $folder string
|
1276 |
+
* @return string
|
1277 |
+
* */
|
1278 |
+
protected static function getTemplatePath($template_name, $default_path, $folder = ''){
|
1279 |
+
$pricing_rules = self::get_instance()->getInstance('FlycartWooDiscountRulesPricingRules');
|
1280 |
+
$path_from_template = $pricing_rules->getTemplateOverride($template_name, $folder);
|
1281 |
+
if($path_from_template) $default_path = $path_from_template;
|
1282 |
+
|
1283 |
+
return $default_path;
|
1284 |
+
}
|
1285 |
}
|
1286 |
}
|
includes/pricing-rules.php
CHANGED
@@ -815,7 +815,11 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
815 |
if(!empty($woocommerce)){
|
816 |
if(!empty($woocommerce->cart)){
|
817 |
if(!empty($woocommerce->cart->cart_contents)){
|
818 |
-
$cart_contents = $
|
|
|
|
|
|
|
|
|
819 |
}
|
820 |
}
|
821 |
}
|
@@ -1397,7 +1401,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1397 |
}
|
1398 |
}
|
1399 |
} else if(isset($rule['method']) && $rule['method'] == 'product_based'){
|
1400 |
-
$checkRuleMatches = $this->checkProductBasedRuleMatches($rule, $item, $quantity);
|
1401 |
self::$product_on_sale_details[$index] = array('type' => 'product_dependent', 'details' => $rule);
|
1402 |
if(!empty($checkRuleMatches)){
|
1403 |
if(class_exists('FlycartWooDiscountRulesPriceProductDependent'))
|
@@ -1459,7 +1463,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1459 |
/**
|
1460 |
* Check Product based rules matches
|
1461 |
* */
|
1462 |
-
public function checkProductBasedRuleMatches($rule, $item, $quantity){
|
1463 |
$result = array();
|
1464 |
if(isset($rule['product_based_condition']) && !empty($rule['product_based_condition'])){
|
1465 |
$product_based_conditions = $rule['product_based_condition'];
|
@@ -1484,7 +1488,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1484 |
$discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
1485 |
$discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
1486 |
$cart = FlycartWoocommerceCart::get_cart();
|
1487 |
-
$_quantity = array();
|
1488 |
if(isset($item['variation_id']) && $item['variation_id'])
|
1489 |
$product_id = $item['variation_id'];
|
1490 |
else
|
@@ -1507,6 +1511,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1507 |
}
|
1508 |
}
|
1509 |
}
|
|
|
1510 |
if ( sizeof( $cart ) > 0 ) {
|
1511 |
if(is_array($product_to_buy) && count($product_to_buy)){
|
1512 |
foreach ($product_to_buy as $key => $productId) {
|
@@ -1522,6 +1527,25 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1522 |
}
|
1523 |
}
|
1524 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1525 |
$quantity = FlycartWooDiscountRulesPriceProductBased::adjustQuantity($buy_type, $_quantity);
|
1526 |
if((in_array($product_id, $product_to_buy) || in_array($product_id, $product_to_apply)) && !empty($_quantity)){
|
1527 |
$proceed = 1;
|
@@ -1530,6 +1554,20 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
1530 |
$matchedProducts = array_intersect($allProductsInCart, $product_to_buy);
|
1531 |
if(count($product_to_buy) != count($matchedProducts)) $proceed = 0;
|
1532 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1533 |
if($proceed){
|
1534 |
$quantityMatched = FlycartWooDiscountRulesPriceProductBased::verifyQuantity($quantity_rule, $quantity, $quantity_from, $quantity_to, $buy_type);
|
1535 |
if($quantityMatched){
|
@@ -2453,12 +2491,18 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
2453 |
/**
|
2454 |
* Get template override
|
2455 |
* @param string $template_name
|
|
|
2456 |
* @return string
|
2457 |
* */
|
2458 |
-
public function getTemplateOverride($template_name){
|
|
|
|
|
|
|
|
|
|
|
2459 |
$template = locate_template(
|
2460 |
array(
|
2461 |
-
|
2462 |
$template_name,
|
2463 |
)
|
2464 |
);
|
@@ -2611,9 +2655,13 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
2611 |
$product_based_conditions = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
2612 |
$product_to_buy = isset($product_based_conditions['product_to_buy']) ? $product_based_conditions['product_to_buy'] : array();
|
2613 |
$product_to_buy = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($product_to_buy);
|
|
|
|
|
2614 |
$product_to_apply = isset($product_based_conditions['product_to_apply']) ? $product_based_conditions['product_to_apply'] : array();
|
2615 |
$get_discount_type = isset($product_based_conditions['get_discount_type']) ? $product_based_conditions['get_discount_type'] : 'product';
|
2616 |
$product_to_apply = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($product_to_apply);
|
|
|
|
|
2617 |
$matched_category = false;
|
2618 |
if($get_discount_type == 'category'){
|
2619 |
$category = FlycartWooDiscountRulesGeneralHelper::getCategoryByPost($id, true);
|
@@ -3770,18 +3818,30 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
|
|
3770 |
}
|
3771 |
$leastPrice = '';
|
3772 |
if($minProductId){
|
3773 |
-
|
3774 |
-
|
3775 |
-
|
3776 |
-
}
|
3777 |
-
if($maxProductId){
|
3778 |
-
$maxProduct = FlycartWoocommerceProduct::wc_get_product($maxProductId);
|
3779 |
-
$greatestPrice = FlycartWoocommerceProduct::get_price($maxProduct);
|
3780 |
-
$greatestPrice = FlycartWoocommerceProduct::wc_price($greatestPrice);
|
3781 |
-
if(!empty($leastPrice)){
|
3782 |
$minProduct = FlycartWoocommerceProduct::wc_get_product($minProductId);
|
3783 |
$leastPrice = FlycartWoocommerceProduct::get_price($minProduct);
|
3784 |
$leastPrice = FlycartWoocommerceProduct::wc_price($leastPrice);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3785 |
if($display_only_lowest_price){
|
3786 |
$price_to_display = $leastPrice;
|
3787 |
} else {
|
815 |
if(!empty($woocommerce)){
|
816 |
if(!empty($woocommerce->cart)){
|
817 |
if(!empty($woocommerce->cart->cart_contents)){
|
818 |
+
$cart_contents = $woocommerce->cart->cart_contents;
|
819 |
+
/**
|
820 |
+
* Deprecated as the work flow has changed in newer versions
|
821 |
+
* */
|
822 |
+
/*$cart_contents = $this->sortCartPrice($woocommerce->cart->cart_contents, 'asc');*/
|
823 |
}
|
824 |
}
|
825 |
}
|
1401 |
}
|
1402 |
}
|
1403 |
} else if(isset($rule['method']) && $rule['method'] == 'product_based'){
|
1404 |
+
$checkRuleMatches = $this->checkProductBasedRuleMatches($rule, $item, $quantity, $product_page);
|
1405 |
self::$product_on_sale_details[$index] = array('type' => 'product_dependent', 'details' => $rule);
|
1406 |
if(!empty($checkRuleMatches)){
|
1407 |
if(class_exists('FlycartWooDiscountRulesPriceProductDependent'))
|
1463 |
/**
|
1464 |
* Check Product based rules matches
|
1465 |
* */
|
1466 |
+
public function checkProductBasedRuleMatches($rule, $item, $quantity, $product_page){
|
1467 |
$result = array();
|
1468 |
if(isset($rule['product_based_condition']) && !empty($rule['product_based_condition'])){
|
1469 |
$product_based_conditions = $rule['product_based_condition'];
|
1488 |
$discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
1489 |
$discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
1490 |
$cart = FlycartWoocommerceCart::get_cart();
|
1491 |
+
$_quantity = $product_to_apply_quantity = array();
|
1492 |
if(isset($item['variation_id']) && $item['variation_id'])
|
1493 |
$product_id = $item['variation_id'];
|
1494 |
else
|
1511 |
}
|
1512 |
}
|
1513 |
}
|
1514 |
+
|
1515 |
if ( sizeof( $cart ) > 0 ) {
|
1516 |
if(is_array($product_to_buy) && count($product_to_buy)){
|
1517 |
foreach ($product_to_buy as $key => $productId) {
|
1527 |
}
|
1528 |
}
|
1529 |
}
|
1530 |
+
|
1531 |
+
$check_for_qty = 1;
|
1532 |
+
if ( sizeof( $cart ) > 0 ) {
|
1533 |
+
if(is_array($product_to_apply) && count($product_to_apply)){
|
1534 |
+
foreach ($product_to_apply as $key => $productId) {
|
1535 |
+
foreach ($cart as $cart_item_key => $values) {
|
1536 |
+
if(empty($values['data'])){
|
1537 |
+
continue;
|
1538 |
+
}
|
1539 |
+
$_product = $values['data'];
|
1540 |
+
if (FlycartWoocommerceProduct::get_id($_product) == $productId){
|
1541 |
+
$product_to_apply_quantity[$productId] = $values['quantity'];
|
1542 |
+
$check_for_qty += $values['quantity'];
|
1543 |
+
}
|
1544 |
+
}
|
1545 |
+
}
|
1546 |
+
}
|
1547 |
+
}
|
1548 |
+
|
1549 |
$quantity = FlycartWooDiscountRulesPriceProductBased::adjustQuantity($buy_type, $_quantity);
|
1550 |
if((in_array($product_id, $product_to_buy) || in_array($product_id, $product_to_apply)) && !empty($_quantity)){
|
1551 |
$proceed = 1;
|
1554 |
$matchedProducts = array_intersect($allProductsInCart, $product_to_buy);
|
1555 |
if(count($product_to_buy) != count($matchedProducts)) $proceed = 0;
|
1556 |
}
|
1557 |
+
if($product_page){
|
1558 |
+
$product_to_apply_count_option = isset($product_based_conditions['product_to_apply_count_option'])? $product_based_conditions['product_to_apply_count_option']: 'all';
|
1559 |
+
$product_to_apply_count = isset($product_based_conditions['product_to_apply_count'])? $product_based_conditions['product_to_apply_count']: '';
|
1560 |
+
if($product_to_apply_count_option == 'apply_first'){
|
1561 |
+
if((int)$product_to_apply_count < $check_for_qty){
|
1562 |
+
$proceed = 0;
|
1563 |
+
}
|
1564 |
+
} else if($product_to_apply_count_option == 'skip_first'){
|
1565 |
+
if((int)$product_to_apply_count >= $check_for_qty){
|
1566 |
+
$proceed = 0;
|
1567 |
+
}
|
1568 |
+
}
|
1569 |
+
}
|
1570 |
+
|
1571 |
if($proceed){
|
1572 |
$quantityMatched = FlycartWooDiscountRulesPriceProductBased::verifyQuantity($quantity_rule, $quantity, $quantity_from, $quantity_to, $buy_type);
|
1573 |
if($quantityMatched){
|
2491 |
/**
|
2492 |
* Get template override
|
2493 |
* @param string $template_name
|
2494 |
+
* @param string $folder
|
2495 |
* @return string
|
2496 |
* */
|
2497 |
+
public function getTemplateOverride($template_name, $folder = ''){
|
2498 |
+
if(!empty($folder)){
|
2499 |
+
$path = trailingslashit( dirname(WOO_DISCOUNT_PLUGIN_BASENAME) ) .$folder."/".$template_name;
|
2500 |
+
} else {
|
2501 |
+
$path = trailingslashit( dirname(WOO_DISCOUNT_PLUGIN_BASENAME) ) . $template_name;
|
2502 |
+
}
|
2503 |
$template = locate_template(
|
2504 |
array(
|
2505 |
+
$path,
|
2506 |
$template_name,
|
2507 |
)
|
2508 |
);
|
2655 |
$product_based_conditions = json_decode((isset($rule->product_based_condition) ? $rule->product_based_condition : '{}'), true);
|
2656 |
$product_to_buy = isset($product_based_conditions['product_to_buy']) ? $product_based_conditions['product_to_buy'] : array();
|
2657 |
$product_to_buy = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($product_to_buy);
|
2658 |
+
$variants = null;
|
2659 |
+
$product_to_buy = apply_filters('woo_discount_rule_products_to_include', $product_to_buy, $rule, $variants);
|
2660 |
$product_to_apply = isset($product_based_conditions['product_to_apply']) ? $product_based_conditions['product_to_apply'] : array();
|
2661 |
$get_discount_type = isset($product_based_conditions['get_discount_type']) ? $product_based_conditions['get_discount_type'] : 'product';
|
2662 |
$product_to_apply = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($product_to_apply);
|
2663 |
+
$variants = null;
|
2664 |
+
$product_to_apply = apply_filters('woo_discount_rule_products_to_include', $product_to_apply, $rule, $variants);
|
2665 |
$matched_category = false;
|
2666 |
if($get_discount_type == 'category'){
|
2667 |
$category = FlycartWooDiscountRulesGeneralHelper::getCategoryByPost($id, true);
|
3818 |
}
|
3819 |
$leastPrice = '';
|
3820 |
if($minProductId){
|
3821 |
+
if(isset($child_prices[$minProductId])){
|
3822 |
+
$leastPrice = FlycartWoocommerceProduct::wc_price($child_prices[$minProductId]);
|
3823 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
3824 |
$minProduct = FlycartWoocommerceProduct::wc_get_product($minProductId);
|
3825 |
$leastPrice = FlycartWoocommerceProduct::get_price($minProduct);
|
3826 |
$leastPrice = FlycartWoocommerceProduct::wc_price($leastPrice);
|
3827 |
+
}
|
3828 |
+
}
|
3829 |
+
if($maxProductId){
|
3830 |
+
if(isset($child_prices[$maxProductId])){
|
3831 |
+
$greatestPrice = FlycartWoocommerceProduct::wc_price($child_prices[$maxProductId]);
|
3832 |
+
} else {
|
3833 |
+
$maxProduct = FlycartWoocommerceProduct::wc_get_product($maxProductId);
|
3834 |
+
$greatestPrice = FlycartWoocommerceProduct::get_price($maxProduct);
|
3835 |
+
$greatestPrice = FlycartWoocommerceProduct::wc_price($greatestPrice);
|
3836 |
+
}
|
3837 |
+
if(!empty($leastPrice)){
|
3838 |
+
if(isset($child_prices[$minProductId])){
|
3839 |
+
$leastPrice = FlycartWoocommerceProduct::wc_price($child_prices[$minProductId]);
|
3840 |
+
} else {
|
3841 |
+
$minProduct = FlycartWoocommerceProduct::wc_get_product($minProductId);
|
3842 |
+
$leastPrice = FlycartWoocommerceProduct::get_price($minProduct);
|
3843 |
+
$leastPrice = FlycartWoocommerceProduct::wc_price($leastPrice);
|
3844 |
+
}
|
3845 |
if($display_only_lowest_price){
|
3846 |
$price_to_display = $leastPrice;
|
3847 |
} else {
|
loader.php
CHANGED
@@ -397,6 +397,13 @@ if(!class_exists('FlycartWooDiscountRules')){
|
|
397 |
|
398 |
add_filter('woo_discount_rule_products_to_exclude', array($this, 'woo_discount_get_variations'), 3, 10);
|
399 |
add_filter('woo_discount_rule_products_to_include', array($this, 'woo_discount_get_variations'), 3, 10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
}
|
401 |
|
402 |
/**
|
397 |
|
398 |
add_filter('woo_discount_rule_products_to_exclude', array($this, 'woo_discount_get_variations'), 3, 10);
|
399 |
add_filter('woo_discount_rule_products_to_include', array($this, 'woo_discount_get_variations'), 3, 10);
|
400 |
+
|
401 |
+
$force_customize_sale_tag = $this->discountBase->getConfigData('force_customize_sale_tag', 0);
|
402 |
+
if($force_customize_sale_tag){
|
403 |
+
add_action( "wp_loaded", array( 'FlycartWooDiscountBase', 'removeHooksSetByOtherPlugins' ) );
|
404 |
+
// change template of sale tag
|
405 |
+
add_filter('wc_get_template', array( 'FlycartWooDiscountBase', 'changeTemplateForSaleTag'), 10, 5);
|
406 |
+
}
|
407 |
}
|
408 |
|
409 |
/**
|
readme.txt
CHANGED
@@ -4,11 +4,12 @@ Donate link: https://flycart.org/
|
|
4 |
Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 5.2
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
11 |
-
Create simple to complex discount rules, dynamic pricing and discounts
|
|
|
12 |
== Description ==
|
13 |
|
14 |
[Discount Rules for WooCommerce](https://www.flycart.org/products/wordpress/woocommerce-discount-rules) helps you to create any type of bulk discounts, dynamic pricing, advanced discounts, percentage discounts, product based discounts, tiered discounts for your products. Offer Product quantity based discounts, cart based discounts at a percentage or fixed amount or discount based on total order. Create Buy One and Get one free (BOGO) deals and increase your sales multifold by offering dynamic pricing and discounts based on categories, products, user roles, cart items, purchase history and much more in the pro version.
|
@@ -212,6 +213,7 @@ We are happy to help you and guide you with the set up.
|
|
212 |
Just reach out to us and we will get back to you. You can either contact us via the Live Chat or via the [support request form](https://www.flycart.org/support)
|
213 |
|
214 |
== Installation ==
|
|
|
215 |
Just use the WordPress installer or upload to the /wp-content/plugins folder. Then Activate the Woo Discount Rules plugin.
|
216 |
More information could be found in the documentation
|
217 |
|
@@ -224,9 +226,9 @@ More information could be found in the documentation
|
|
224 |
|
225 |
== Frequently asked questions ==
|
226 |
|
227 |
-
= Are multiple discounts possible ?
|
228 |
|
229 |
-
Yes. It is possible to create multiple
|
230 |
|
231 |
= Are the discounts visible in Product page ? =
|
232 |
|
@@ -279,13 +281,17 @@ Yes. You can provide buy 1 get 1 offers in your store.
|
|
279 |
|
280 |
In that case, the rule with the higher priority will be applied.
|
281 |
|
|
|
|
|
|
|
|
|
282 |
= What happens after my PRO license expires ? =
|
283 |
|
284 |
You can continue using Discount Rules for WooCommerce plugin in your site. However you won’t be able to receive the Updates and priority support.
|
285 |
|
286 |
= What is your refund policy? =
|
287 |
|
288 |
-
We do have a 14-
|
289 |
|
290 |
= Can I set discount based on Billing Country and City ? =
|
291 |
|
@@ -300,10 +306,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
300 |
|
301 |
== Screenshots ==
|
302 |
|
303 |
-
1.
|
304 |
2. Price rules and Cart rules
|
305 |
3. Creating a price rule
|
306 |
-
4. Example Promotion Offers created using
|
307 |
5. Discounted price is applied in the Cart
|
308 |
|
309 |
== Credits ==
|
@@ -312,6 +318,15 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
312 |
|
313 |
== Changelog ==
|
314 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
= 1.7.17 - 04/07/19 =
|
316 |
* Fix - Fatal error while API request.
|
317 |
* Fix - Free shipping not works when update shipping state through calculate shipping option in cart.
|
4 |
Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 5.2
|
7 |
+
Stable tag: 1.7.18
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
11 |
+
Create simple to complex discount rules, dynamic pricing and discounts. A flexible and powerful WooCommerce discount plugin.
|
12 |
+
|
13 |
== Description ==
|
14 |
|
15 |
[Discount Rules for WooCommerce](https://www.flycart.org/products/wordpress/woocommerce-discount-rules) helps you to create any type of bulk discounts, dynamic pricing, advanced discounts, percentage discounts, product based discounts, tiered discounts for your products. Offer Product quantity based discounts, cart based discounts at a percentage or fixed amount or discount based on total order. Create Buy One and Get one free (BOGO) deals and increase your sales multifold by offering dynamic pricing and discounts based on categories, products, user roles, cart items, purchase history and much more in the pro version.
|
213 |
Just reach out to us and we will get back to you. You can either contact us via the Live Chat or via the [support request form](https://www.flycart.org/support)
|
214 |
|
215 |
== Installation ==
|
216 |
+
|
217 |
Just use the WordPress installer or upload to the /wp-content/plugins folder. Then Activate the Woo Discount Rules plugin.
|
218 |
More information could be found in the documentation
|
219 |
|
226 |
|
227 |
== Frequently asked questions ==
|
228 |
|
229 |
+
= Are multiple discounts possible ? =
|
230 |
|
231 |
+
Yes. It is possible to create multiple discounts.
|
232 |
|
233 |
= Are the discounts visible in Product page ? =
|
234 |
|
281 |
|
282 |
In that case, the rule with the higher priority will be applied.
|
283 |
|
284 |
+
= Are there any limit for the number of rules ? =
|
285 |
+
|
286 |
+
While free version allows you up to 3 rules in each discount type, the PRO version helps you setup unlimited discount rules in your store.
|
287 |
+
|
288 |
= What happens after my PRO license expires ? =
|
289 |
|
290 |
You can continue using Discount Rules for WooCommerce plugin in your site. However you won’t be able to receive the Updates and priority support.
|
291 |
|
292 |
= What is your refund policy? =
|
293 |
|
294 |
+
We do have a 14-day money back guarantee. If our plugin doesn’t meet your requirements, we can issue a full refund. No compromise in that.
|
295 |
|
296 |
= Can I set discount based on Billing Country and City ? =
|
297 |
|
306 |
|
307 |
== Screenshots ==
|
308 |
|
309 |
+
1. Discount Rules menu
|
310 |
2. Price rules and Cart rules
|
311 |
3. Creating a price rule
|
312 |
+
4. Example Promotion Offers created using Discount rules
|
313 |
5. Discounted price is applied in the Cart
|
314 |
|
315 |
== Credits ==
|
318 |
|
319 |
== Changelog ==
|
320 |
|
321 |
+
= 1.7.18 - 30/07/19 =
|
322 |
+
* Feature - Force override the label for sale badge option.
|
323 |
+
* Fix - Include child variants while parent is chosen in product dependent rule.
|
324 |
+
* Fix - Wrong strike-out for product dependent rule on skip first option is chosen.
|
325 |
+
* Fix - Wrong strike-out for variable product on apply discount apply based on regular price.
|
326 |
+
* Fix - Get free product price from cart line item instead of loading original product (BOGO cart rule).
|
327 |
+
* Improvement - Performance on having more items in cart.
|
328 |
+
* Improvement - Event apply_filters('woo_discount_rules_variation_is_visible', $visible, $product).
|
329 |
+
|
330 |
= 1.7.17 - 04/07/19 =
|
331 |
* Fix - Fatal error while API request.
|
332 |
* Fix - Free shipping not works when update shipping state through calculate shipping option in cart.
|
view/settings_general.php
CHANGED
@@ -54,12 +54,12 @@ if (!defined('ABSPATH')) exit; // Exit if accessed directly
|
|
54 |
</div>
|
55 |
<?php $data['enable_bootstrap'] = (isset($data['enable_bootstrap']) ? $data['enable_bootstrap'] : 1); ?>
|
56 |
<div class="col-md-6">
|
57 |
-
<label><input type="radio" name="enable_bootstrap" value="1" <?php echo ($data['enable_bootstrap'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
|
58 |
<label><input type="radio" name="enable_bootstrap" value="0" <?php echo ($data['enable_bootstrap'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
|
59 |
<div class="wdr_desc_text_con">
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
</div>
|
64 |
</div>
|
65 |
</div>
|
54 |
</div>
|
55 |
<?php $data['enable_bootstrap'] = (isset($data['enable_bootstrap']) ? $data['enable_bootstrap'] : 1); ?>
|
56 |
<div class="col-md-6">
|
57 |
+
<label><input type="radio" name="enable_bootstrap" id="enable_bootstrap_id" data-val="<?php echo $data['enable_bootstrap']; ?>" value="1" <?php echo ($data['enable_bootstrap'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
|
58 |
<label><input type="radio" name="enable_bootstrap" value="0" <?php echo ($data['enable_bootstrap'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
|
59 |
<div class="wdr_desc_text_con">
|
60 |
+
<span class="wdr_desc_text">
|
61 |
+
<?php esc_html_e('Disabling this setting may affect dropdowns in rule engine (Disabling this setting is not recommended). Change this only if you know what you are doing.', 'woo-discount-rules'); ?>
|
62 |
+
</span>
|
63 |
</div>
|
64 |
</div>
|
65 |
</div>
|
view/settings_price_rules.php
CHANGED
@@ -289,6 +289,7 @@ if (!defined('ABSPATH')) exit; // Exit if accessed directly
|
|
289 |
</div>
|
290 |
<div class="row form-group">
|
291 |
<?php $data['customize_sale_tag'] = (isset($data['customize_sale_tag']) ? $data['customize_sale_tag'] : 0); ?>
|
|
|
292 |
<div class="col-md-2">
|
293 |
<label for="customize_sale_tag">
|
294 |
<?php esc_html_e('Do you want to customize the sale badge?', 'woo-discount-rules'); ?>
|
@@ -299,6 +300,8 @@ if (!defined('ABSPATH')) exit; // Exit if accessed directly
|
|
299 |
if($isPro){
|
300 |
?>
|
301 |
<input type="checkbox" name="customize_sale_tag" id="customize_sale_tag" value="1" <?php if ($data['customize_sale_tag'] == 1) { ?> checked <?php } ?>> <label for="customize_sale_tag"><?php esc_html_e('Yes, I would like to customize the sale badge', 'woo-discount-rules'); ?></label>
|
|
|
|
|
302 |
<?php
|
303 |
} else {
|
304 |
esc_html_e('Supported in PRO version', 'woo-discount-rules');
|
289 |
</div>
|
290 |
<div class="row form-group">
|
291 |
<?php $data['customize_sale_tag'] = (isset($data['customize_sale_tag']) ? $data['customize_sale_tag'] : 0); ?>
|
292 |
+
<?php $data['force_customize_sale_tag'] = (isset($data['force_customize_sale_tag']) ? $data['force_customize_sale_tag'] : 0); ?>
|
293 |
<div class="col-md-2">
|
294 |
<label for="customize_sale_tag">
|
295 |
<?php esc_html_e('Do you want to customize the sale badge?', 'woo-discount-rules'); ?>
|
300 |
if($isPro){
|
301 |
?>
|
302 |
<input type="checkbox" name="customize_sale_tag" id="customize_sale_tag" value="1" <?php if ($data['customize_sale_tag'] == 1) { ?> checked <?php } ?>> <label for="customize_sale_tag"><?php esc_html_e('Yes, I would like to customize the sale badge', 'woo-discount-rules'); ?></label>
|
303 |
+
<br>
|
304 |
+
<input type="checkbox" name="force_customize_sale_tag" id="force_customize_sale_tag" value="1" <?php if ($data['force_customize_sale_tag'] == 1) { ?> checked <?php } ?>> <label for="force_customize_sale_tag"><?php esc_html_e('Force override the label for sale badge (useful when your theme has override for sale badge).', 'woo-discount-rules'); ?></label>
|
305 |
<?php
|
306 |
} else {
|
307 |
esc_html_e('Supported in PRO version', 'woo-discount-rules');
|
view/template/loop/sale-flash.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Product loop sale flash
|
4 |
+
*
|
5 |
+
* This template can be overridden by copying it to yourtheme/woo-discount-rules/loop/sale-flash.php.
|
6 |
+
*
|
7 |
+
* HOWEVER, on occasion Woo Discount Rules will need to update template files and you
|
8 |
+
* (the theme developer) will need to copy the new files to your theme to
|
9 |
+
* maintain compatibility. We try to do this as little as possible, but it does
|
10 |
+
* happen. When this occurs the version of the template file will be bumped and
|
11 |
+
* the readme will list any important changes.
|
12 |
+
*/
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit; // Exit if accessed directly
|
16 |
+
}
|
17 |
+
|
18 |
+
global $post, $product;
|
19 |
+
|
20 |
+
?>
|
21 |
+
<?php if ( $product->is_on_sale() ) : ?>
|
22 |
+
|
23 |
+
<?php echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale wdr-onsale">' . esc_html__( 'Sale!', 'woocommerce' ) . '</span>', $post, $product ); ?>
|
24 |
+
|
25 |
+
<?php endif;
|
26 |
+
|
27 |
+
/* Omit closing PHP tag at the end of PHP files to avoid "headers already sent" issues. */
|
view/template/single-product/sale-flash.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Single Product Sale Flash
|
4 |
+
*
|
5 |
+
* This template can be overridden by copying it to yourtheme/woo-discount-rules/single-product/sale-flash.php.
|
6 |
+
*
|
7 |
+
* HOWEVER, on occasion Woo Discount Rules will need to update template files and you
|
8 |
+
* (the theme developer) will need to copy the new files to your theme to
|
9 |
+
* maintain compatibility. We try to do this as little as possible, but it does
|
10 |
+
* happen. When this occurs the version of the template file will be bumped and
|
11 |
+
* the readme will list any important changes.
|
12 |
+
*/
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit; // Exit if accessed directly
|
16 |
+
}
|
17 |
+
|
18 |
+
global $post, $product;
|
19 |
+
|
20 |
+
?>
|
21 |
+
<?php if ( $product->is_on_sale() ) : ?>
|
22 |
+
|
23 |
+
<?php echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale wdr-onsale">' . esc_html__( 'Sale!', 'woocommerce' ) . '</span>', $post, $product ); ?>
|
24 |
+
|
25 |
+
<?php endif;
|
26 |
+
|
27 |
+
/* Omit closing PHP tag at the end of PHP files to avoid "headers already sent" issues. */
|
woo-discount-rules.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Simple Discount Rules for WooCommerce.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
-
* Version: 1.7.
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|
5 |
* Description: Simple Discount Rules for WooCommerce.
|
6 |
* Author: Flycart Technologies LLP
|
7 |
* Author URI: https://www.flycart.org
|
8 |
+
* Version: 1.7.18
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Domain Path: /i18n/languages/
|