Discount Rules for WooCommerce - Version 1.8.1

Version Description

  • 21/10/19 =
  • Feature - First order option in Purchase history.
  • Feature - Category exclude option in cart rules.
  • Feature - Create coupon option instead of selecting from woocommerce coupon for coupon based rules.
  • Improvement - Increased the priority for the hook woocommerce_get_price_html to 1000
  • Improvement - Event apply_filters('woo_discount_rules_exclude_product_from_discount', false, $item['data'], $id, $rule, $item);
  • Improvement - Event update apply_filters('woo_discount_rules_rule_matches_to_display_in_table', $status, $product, $rule, $index);
  • Improvement - Option to hide the discount table from front end while login as admin.
  • Improvement - Removed options Any one cheapest from selected and Any one cheapest from all products.
  • Improvement - Give priority to user for purchase history rule.
  • Fix - Changed discount type for free product in cart option so the discount applies only for selected products.
  • Fix - Currency switcher compatible for villa theme.
  • Fix - Wrong subtotal calculation when exclude products is chosen.
  • Fix - Timeout issue when returning customer in checkout for purchase history rule.
  • Fix - Displaying discount table for on-sale product when exclude on-sale product option is enabled.
Download this release

Release Info

Developer flycart
Plugin Icon 128x128 Discount Rules for WooCommerce
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8.0 to 1.8.1

assets/css/style.css CHANGED
@@ -64,9 +64,13 @@
64
  min-width: 250px ;
65
  width: auto !important;
66
  }
67
- .coupons_to_apply_price_rule_con{
 
68
  margin: 10px 0;
69
  }
 
 
 
70
  .woo-discount-hint{
71
  font-size: 13px;
72
  font-style: italic;
@@ -223,4 +227,7 @@ span.price_discount_amount_tool_tip{
223
  .woo-side-panel p {
224
  margin: 0 0 10px;
225
  padding: 0;
 
 
 
226
  }
64
  min-width: 250px ;
65
  width: auto !important;
66
  }
67
+ .coupons_to_apply_price_rule_con,
68
+ .dynamic_coupons_to_apply_price_rule_con{
69
  margin: 10px 0;
70
  }
71
+ .dynamic_coupons_to_apply_price_rule_con input{
72
+ max-width: 215px;
73
+ }
74
  .woo-discount-hint{
75
  font-size: 13px;
76
  font-style: italic;
227
  .woo-side-panel p {
228
  margin: 0 0 10px;
229
  padding: 0;
230
+ }
231
+ .wdr_validation_notice{
232
+ display: none;
233
  }
assets/css/woo_discount_rules.css CHANGED
@@ -6,4 +6,24 @@
6
  }
7
  .wdr_table_content_advance_item{
8
  margin: 5px 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
6
  }
7
  .wdr_table_content_advance_item{
8
  margin: 5px 0;
9
+ }
10
+ .wdr_table_container_for_admin{
11
+ position: relative;
12
+ }
13
+ .wdr_table_cbr:hover{
14
+ border: 1px solid #ddd;
15
+ }
16
+ .wdr_table_off_settings_link_con{
17
+ position: absolute;
18
+ top: 0;
19
+ right: 0;
20
+ display: none;
21
+ background-color: #ddd;
22
+ padding: 0 5px;
23
+ }
24
+ .wdr_table_off_settings_hint{
25
+ font-size: 12px;
26
+ }
27
+ .wdr_table_off_settings_hint{
28
+ display: block;
29
  }
assets/js/app.js CHANGED
@@ -185,8 +185,9 @@ function wooo_discount_range_altered() {
185
 
186
  // Saving Rule.
187
  $('#savePriceRule').on('click', function (event) {
 
188
  var validate = validateFields();
189
-
190
  if ($('#rule_name').val() == '') {
191
  jQuery('a.general_tab').trigger('click');
192
  alert(woo_discount_localization.please_enter_the_rule_name);
@@ -218,17 +219,32 @@ function wooo_discount_range_altered() {
218
  complete: function() {
219
  loader.hide();
220
  },
221
- success: function () {
 
222
  // After Status Changed.
223
  resizeChart = setTimeout(function () {
224
  current.val(woo_discount_localization.save_rule);
225
  }, 300);
226
- // Reset, if its New Form.
227
- if (rule_id == 0) {
228
- $('#form_price_rule')[0].reset();
229
- window.location.replace(admin_url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
- adminNotice();
232
  }
233
 
234
  });
@@ -329,7 +345,7 @@ function wooo_discount_range_altered() {
329
  '<label><span class="hide-for-product-discount">'+woo_discount_localization.value_text+'</span>' +
330
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> ';
331
  form += '<div class="price_discount_product_list_con hide">' +
332
- ' '+woo_discount_localization.apply_for+' <select class="selectpicker discount_product_option" name="discount_range['+count+'][discount_product_option]"><option value="all">'+woo_discount_localization.all_selected+'</option><option value="same_product">'+woo_discount_localization.same_product+'</option><option value="any_cheapest">'+woo_discount_localization.any_one_cheapest_from_selected+'</option><option value="any_cheapest_from_all">'+woo_discount_localization.any_one_cheapest_from_all_products+'</option>' +
333
  '<option value="more_than_one_cheapest_from_cat">'+woo_discount_localization.more_than_one_cheapest_from_selected_category+'</option><option value="more_than_one_cheapest">'+woo_discount_localization.more_than_one_cheapest_from_selected+'</option><option value="more_than_one_cheapest_from_all">'+woo_discount_localization.more_than_one_cheapest_from_all+'</option>' +
334
  '</select>';
335
  form += '&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_product_option_tooltip+'"></span>';
@@ -522,7 +538,12 @@ function wooo_discount_range_altered() {
522
  var option = $(this).val();
523
  if (option == 'none') {
524
  $('.coupons_to_apply_price_rule_con').hide();
 
 
 
 
525
  } else {
 
526
  $('.coupons_to_apply_price_rule_con').show();
527
  }
528
  });
@@ -669,6 +690,7 @@ function wooo_discount_range_altered() {
669
  '<option value="categories_in">'+woo_discount_localization.categories_in_cart+'</option>' +
670
  '<option value="atleast_one_including_sub_categories">'+woo_discount_localization.atleast_one_including_sub_categories+'</option>' +
671
  '<option value="in_each_category">'+woo_discount_localization.in_each_category_cart+'</option>' +
 
672
  '</optgroup>' +
673
  '<optgroup label="'+woo_discount_localization.customer_details_must_be_logged_in+'"><option value="users_in">'+woo_discount_localization.user_in_list+'</option><option value="roles_in">'+woo_discount_localization.user_role_in_list+'</option></optgroup>' +
674
  '<optgroup label="'+woo_discount_localization.customer_email+'"><option value="customer_email_tld">'+woo_discount_localization.customer_email_tld+'</option><option value="customer_email_domain">'+woo_discount_localization.customer_email_domain+'</option></optgroup>' +
@@ -679,14 +701,15 @@ function wooo_discount_range_altered() {
679
  '<option value="shipping_countries_in">'+woo_discount_localization.shipping_country_list+'</option>' +
680
  '<option value="customer_shipping_zip_code">'+woo_discount_localization.customer_shipping_zip_code+'</option></optgroup>' +
681
  '<optgroup label="'+woo_discount_localization.purchase_history+'">' +
 
682
  '<option value="customer_based_on_purchase_history">'+woo_discount_localization.purchased_amount+'</option>'+
683
  '<option value="customer_based_on_purchase_history_order_count">'+woo_discount_localization.number_of_order_purchased+'</option>'+
684
  '<option value="customer_based_on_purchase_history_product_order_count">'+woo_discount_localization.number_of_order_purchased_in_product+'</option>'+
685
  '<option value="customer_based_on_purchase_history_product_quantity_count">'+woo_discount_localization.number_of_order_quantity_purchased_in_product+'</option>'+
686
  '</optgroup>' +
687
- '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option value="coupon_applied_any_one">'+woo_discount_localization.atleast_any_one+'</option><option value="coupon_applied_all_selected">'+woo_discount_localization.all_selected_coupon+'</option></optgroup>' +
688
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
689
- '<div class="col-md-3 form-group"><label> <span class="value_text_' +count+ '">'+woo_discount_localization.value_text+'</span><div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
690
  '<div id="user_div_' + count + '">';
691
  if($('#flycart_wdr_woocommerce_version').val() == 2){
692
  form += '<input class="wc-customer-search" style="width: 250px" name="discount_rule[' + count + '][users_to_apply][]" data-placeholder="'+woo_discount_localization.place_holder_search_for_a_user+'"/>';
@@ -727,7 +750,7 @@ function wooo_discount_range_altered() {
727
  '<span class="purchased_history_duration_days_con" id="purchased_history_duration_days_con_'+count+'">' +
728
  '<input name="discount_rule['+count+'][purchased_history_duration_days]" value="" placeholder="30" type="text"/> '+woo_discount_localization.in_days+
729
  '</span>' +
730
- '</div>' +
731
  '</div><div class="col-md-1"> <label> '+woo_discount_localization.action_text+'</label> <br> <a href=javascript:void(0) class="btn btn-danger remove_cart_rule">'+woo_discount_localization.remove_text+'</a> </div>' +
732
  '</label></div>';
733
  } else {
@@ -743,6 +766,7 @@ function wooo_discount_range_altered() {
743
  '<option disabled>'+woo_discount_localization.categories_in_cart+' <b>' + pro_suffix + '</b></option>' +
744
  '<option disabled>'+woo_discount_localization.atleast_one_including_sub_categories+' <b>' + pro_suffix + '</b></option>' +
745
  '<option disabled>'+woo_discount_localization.in_each_category_cart+' <b>' + pro_suffix + '</b></option>' +
 
746
  '</optgroup>' +
747
  '<optgroup label="'+woo_discount_localization.customer_details_must_be_logged_in+'"><option disabled>'+woo_discount_localization.user_in_list+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.user_role_in_list+' <b>' + pro_suffix + '</b></option></optgroup>' +
748
  '<optgroup label="'+woo_discount_localization.customer_email+'"><option disabled>'+woo_discount_localization.customer_email_tld+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.customer_email_domain+'<b>' + pro_suffix + '</b></option></optgroup>' +
@@ -758,7 +782,7 @@ function wooo_discount_range_altered() {
758
  '</optgroup>' +
759
  '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option disabled>'+woo_discount_localization.atleast_any_one+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.all_selected+' <b>' + pro_suffix + '</b></option></optgroup>' +
760
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
761
- '<div class="col-md-3 form-group"><label> <span class="value_text_'+count+'">'+woo_discount_localization.value_text+'</span><div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
762
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
763
  '<div id="product_div_' + count + '"><select id="cart_product_list_' + count + '" class="product_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][product_to_apply][]"></select></div>' +
764
  '<div id="category_div_' + count + '"><select id="cart_category_list_' + count + '" class="category_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][category_to_apply][]"></select></div>' +
@@ -945,6 +969,8 @@ function wooo_discount_range_altered() {
945
 
946
  // Saving Cart Rule.
947
  $('#saveCartRule').on('click', function (event) {
 
 
948
  var form = $('#form_cart_rule').serialize();
949
  var current = $(this);
950
  var rule_id = $('#rule_id').val();
@@ -964,17 +990,35 @@ function wooo_discount_range_altered() {
964
  complete: function() {
965
  loader.hide();
966
  },
967
- success: function () {
 
968
  // After Status Changed.
969
  resizeChart = setTimeout(function () {
970
  current.val(woo_discount_localization.save_rule);
971
  }, 300);
972
-
973
- // Reset, if its New Form.
974
- if (rule_id == 0) {
975
- window.location.replace(admin_url + '&tab=cart-rules');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
976
  }
977
- adminNotice();
978
  }
979
  });
980
  }
@@ -1056,7 +1100,7 @@ function wooo_discount_range_altered() {
1056
 
1057
  $('#based_on_purchase_history').on('change', function () {
1058
  var checked = $( this ).val();
1059
- if(checked == "0" || checked == ""){
1060
  $('#based_on_purchase_history_fields').hide();
1061
  } else {
1062
  $('#based_on_purchase_history_fields').show();
@@ -1404,7 +1448,7 @@ function wooo_discount_range_altered() {
1404
  $('.value_text_'+id).css('display', 'block');
1405
  if (option == 'products_atleast_one' || option == 'products_not_in') {
1406
  processShowOnlyTags('product_div_', id);
1407
- } else if (option == 'categories_atleast_one' || option == 'categories_not_in' || option == 'categories_in' || option == 'in_each_category' || option == 'atleast_one_including_sub_categories') {
1408
  processShowOnlyTags('category_div_', id);
1409
  } else if (option == 'coupon_applied_any_one' || option == 'coupon_applied_all_selected') {
1410
  processShowOnlyTags('coupon_div_', id);
@@ -1419,6 +1463,10 @@ function wooo_discount_range_altered() {
1419
  } else if (option == 'exclude_sale_products') {
1420
  $('.value_text_'+id).css('display', 'none');
1421
  processShowOnlyTags('exclude_on_sale_products_div_', id);
 
 
 
 
1422
  } else if (option == 'customer_based_on_purchase_history' || option == 'customer_based_on_purchase_history_product_order_count' || option == 'customer_based_on_purchase_history_order_count' || option == 'customer_based_on_purchase_history_product_quantity_count') {
1423
  processShowOnlyTags('purchase_history_div_', id);
1424
  if(option == 'customer_based_on_purchase_history_product_order_count' || option == 'customer_based_on_purchase_history_product_quantity_count'){
@@ -1440,6 +1488,14 @@ function wooo_discount_range_altered() {
1440
  }, 2000);
1441
  }
1442
 
 
 
 
 
 
 
 
 
1443
  function makeActiveForSelectedTab(selected){
1444
  var container = selected.closest('.nav-tab-wrapper');
1445
  container.find('.nav-tab').removeClass('nav-tab-active');
185
 
186
  // Saving Rule.
187
  $('#savePriceRule').on('click', function (event) {
188
+ $(".form-control").removeClass('wdr_invalid');
189
  var validate = validateFields();
190
+ $(".wdr_validation_notice").hide();
191
  if ($('#rule_name').val() == '') {
192
  jQuery('a.general_tab').trigger('click');
193
  alert(woo_discount_localization.please_enter_the_rule_name);
219
  complete: function() {
220
  loader.hide();
221
  },
222
+ success: function (result) {
223
+ var result = jQuery.parseJSON( result );
224
  // After Status Changed.
225
  resizeChart = setTimeout(function () {
226
  current.val(woo_discount_localization.save_rule);
227
  }, 300);
228
+ if(result.status == 1){
229
+ // Reset, if its New Form.
230
+ if (rule_id == 0) {
231
+ $('#form_price_rule')[0].reset();
232
+ window.location.replace(admin_url);
233
+ }
234
+ adminNotice();
235
+ } else {
236
+ //woo_discount_rule_error_notice(result.message);
237
+ if(result.invalid_field != undefined){
238
+ if(result.invalid_field == "dynamic_coupons_to_apply"){
239
+ $("input[name='dynamic_coupons_to_apply']").addClass('wdr_invalid');
240
+ $("a.restriction_tab").trigger('click');
241
+ $("div.dynamic_coupons_to_apply_validation").html("<p>"+result.error_message+"</p>").show();
242
+ }
243
+ }
244
+ }
245
+ if(result.dynamic_coupons_to_apply != undefined){
246
+ $("input[name='dynamic_coupons_to_apply']").val(result.dynamic_coupons_to_apply);
247
  }
 
248
  }
249
 
250
  });
345
  '<label><span class="hide-for-product-discount">'+woo_discount_localization.value_text+'</span>' +
346
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> ';
347
  form += '<div class="price_discount_product_list_con hide">' +
348
+ ' '+woo_discount_localization.apply_for+' <select class="selectpicker discount_product_option" name="discount_range['+count+'][discount_product_option]"><option value="all">'+woo_discount_localization.all_selected+'</option><option value="same_product">'+woo_discount_localization.same_product+'</option>' +
349
  '<option value="more_than_one_cheapest_from_cat">'+woo_discount_localization.more_than_one_cheapest_from_selected_category+'</option><option value="more_than_one_cheapest">'+woo_discount_localization.more_than_one_cheapest_from_selected+'</option><option value="more_than_one_cheapest_from_all">'+woo_discount_localization.more_than_one_cheapest_from_all+'</option>' +
350
  '</select>';
351
  form += '&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_product_option_tooltip+'"></span>';
538
  var option = $(this).val();
539
  if (option == 'none') {
540
  $('.coupons_to_apply_price_rule_con').hide();
541
+ $('.dynamic_coupons_to_apply_price_rule_con').hide();
542
+ } else if (option == 'create_dynamic_coupon') {
543
+ $('.coupons_to_apply_price_rule_con').hide();
544
+ $('.dynamic_coupons_to_apply_price_rule_con').show();
545
  } else {
546
+ $('.dynamic_coupons_to_apply_price_rule_con').hide();
547
  $('.coupons_to_apply_price_rule_con').show();
548
  }
549
  });
690
  '<option value="categories_in">'+woo_discount_localization.categories_in_cart+'</option>' +
691
  '<option value="atleast_one_including_sub_categories">'+woo_discount_localization.atleast_one_including_sub_categories+'</option>' +
692
  '<option value="in_each_category">'+woo_discount_localization.in_each_category_cart+'</option>' +
693
+ '<option value="exclude_categories">'+woo_discount_localization.exclude_categories_in_cart+'</option>' +
694
  '</optgroup>' +
695
  '<optgroup label="'+woo_discount_localization.customer_details_must_be_logged_in+'"><option value="users_in">'+woo_discount_localization.user_in_list+'</option><option value="roles_in">'+woo_discount_localization.user_role_in_list+'</option></optgroup>' +
696
  '<optgroup label="'+woo_discount_localization.customer_email+'"><option value="customer_email_tld">'+woo_discount_localization.customer_email_tld+'</option><option value="customer_email_domain">'+woo_discount_localization.customer_email_domain+'</option></optgroup>' +
701
  '<option value="shipping_countries_in">'+woo_discount_localization.shipping_country_list+'</option>' +
702
  '<option value="customer_shipping_zip_code">'+woo_discount_localization.customer_shipping_zip_code+'</option></optgroup>' +
703
  '<optgroup label="'+woo_discount_localization.purchase_history+'">' +
704
+ '<option value="customer_based_on_first_order">'+woo_discount_localization.first_order_discount+'</option>'+
705
  '<option value="customer_based_on_purchase_history">'+woo_discount_localization.purchased_amount+'</option>'+
706
  '<option value="customer_based_on_purchase_history_order_count">'+woo_discount_localization.number_of_order_purchased+'</option>'+
707
  '<option value="customer_based_on_purchase_history_product_order_count">'+woo_discount_localization.number_of_order_purchased_in_product+'</option>'+
708
  '<option value="customer_based_on_purchase_history_product_quantity_count">'+woo_discount_localization.number_of_order_quantity_purchased_in_product+'</option>'+
709
  '</optgroup>' +
710
+ '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option value="create_dynamic_coupon">'+woo_discount_localization.create_a_coupon+'</option><option value="coupon_applied_any_one">'+woo_discount_localization.atleast_any_one+'</option><option value="coupon_applied_all_selected">'+woo_discount_localization.all_selected_coupon+'</option></optgroup>' +
711
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
712
+ '<div class="col-md-3 form-group"><label> <span class="value_text_' +count+ '">'+woo_discount_localization.value_text+'</span><div id="general_' + count + '"><input type="text" class="form-control" name="discount_rule[' + count + '][option_value]"></div>' +
713
  '<div id="user_div_' + count + '">';
714
  if($('#flycart_wdr_woocommerce_version').val() == 2){
715
  form += '<input class="wc-customer-search" style="width: 250px" name="discount_rule[' + count + '][users_to_apply][]" data-placeholder="'+woo_discount_localization.place_holder_search_for_a_user+'"/>';
750
  '<span class="purchased_history_duration_days_con" id="purchased_history_duration_days_con_'+count+'">' +
751
  '<input name="discount_rule['+count+'][purchased_history_duration_days]" value="" placeholder="30" type="text"/> '+woo_discount_localization.in_days+
752
  '</span>' +
753
+ '</div><div class="notice inline notice-alt notice-warning cart_rule_validation_error wdr_validation_notice"></div>' +
754
  '</div><div class="col-md-1"> <label> '+woo_discount_localization.action_text+'</label> <br> <a href=javascript:void(0) class="btn btn-danger remove_cart_rule">'+woo_discount_localization.remove_text+'</a> </div>' +
755
  '</label></div>';
756
  } else {
766
  '<option disabled>'+woo_discount_localization.categories_in_cart+' <b>' + pro_suffix + '</b></option>' +
767
  '<option disabled>'+woo_discount_localization.atleast_one_including_sub_categories+' <b>' + pro_suffix + '</b></option>' +
768
  '<option disabled>'+woo_discount_localization.in_each_category_cart+' <b>' + pro_suffix + '</b></option>' +
769
+ '<option disabled>'+woo_discount_localization.exclude_categories_in_cart+' <b>' + pro_suffix + '</b></option>' +
770
  '</optgroup>' +
771
  '<optgroup label="'+woo_discount_localization.customer_details_must_be_logged_in+'"><option disabled>'+woo_discount_localization.user_in_list+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.user_role_in_list+' <b>' + pro_suffix + '</b></option></optgroup>' +
772
  '<optgroup label="'+woo_discount_localization.customer_email+'"><option disabled>'+woo_discount_localization.customer_email_tld+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.customer_email_domain+'<b>' + pro_suffix + '</b></option></optgroup>' +
782
  '</optgroup>' +
783
  '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option disabled>'+woo_discount_localization.atleast_any_one+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.all_selected+' <b>' + pro_suffix + '</b></option></optgroup>' +
784
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
785
+ '<div class="col-md-3 form-group"><label> <span class="value_text_'+count+'">'+woo_discount_localization.value_text+'</span><div id="general_' + count + '"><input type="text" class="form-control" name="discount_rule[' + count + '][option_value]"></div>' +
786
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
787
  '<div id="product_div_' + count + '"><select id="cart_product_list_' + count + '" class="product_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][product_to_apply][]"></select></div>' +
788
  '<div id="category_div_' + count + '"><select id="cart_category_list_' + count + '" class="category_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][category_to_apply][]"></select></div>' +
969
 
970
  // Saving Cart Rule.
971
  $('#saveCartRule').on('click', function (event) {
972
+ $(".form-control").removeClass('wdr_invalid');
973
+ $("div.cart_rule_validation_error").hide();
974
  var form = $('#form_cart_rule').serialize();
975
  var current = $(this);
976
  var rule_id = $('#rule_id').val();
990
  complete: function() {
991
  loader.hide();
992
  },
993
+ success: function (result) {
994
+ var result = jQuery.parseJSON( result );
995
  // After Status Changed.
996
  resizeChart = setTimeout(function () {
997
  current.val(woo_discount_localization.save_rule);
998
  }, 300);
999
+ console.log(result);
1000
+ if(result.create_dynamic_coupon != undefined){
1001
+ var error_row_con = $('select.cart_rule_type option[value="create_dynamic_coupon"]:selected');
1002
+ console.log(error_row_con);
1003
+ error_row_con.closest('.cart_rules_list').find('input.form-control').val(result.create_dynamic_coupon);
1004
+ $("input[name='dynamic_coupons_to_apply']").val(result.create_dynamic_coupon);
1005
+ }
1006
+ if(result.status == 1){
1007
+ // Reset, if its New Form.
1008
+ if (rule_id == 0) {
1009
+ window.location.replace(admin_url + '&tab=cart-rules');
1010
+ }
1011
+ adminNotice();
1012
+ } else {
1013
+ //woo_discount_rule_error_notice(result.message);
1014
+ if(result.invalid_field != undefined){
1015
+ if(result.invalid_field == "create_dynamic_coupon"){
1016
+ error_row_con.closest('.cart_rules_list').find('input.form-control').addClass('wdr_invalid');
1017
+ $("a.restriction_tab").trigger('click');
1018
+ error_row_con.closest('.cart_rules_list').find("div.cart_rule_validation_error").html("<p>"+result.error_message+"</p>").show();
1019
+ }
1020
+ }
1021
  }
 
1022
  }
1023
  });
1024
  }
1100
 
1101
  $('#based_on_purchase_history').on('change', function () {
1102
  var checked = $( this ).val();
1103
+ if(checked == "0" || checked == "" || checked == "first_order"){
1104
  $('#based_on_purchase_history_fields').hide();
1105
  } else {
1106
  $('#based_on_purchase_history_fields').show();
1448
  $('.value_text_'+id).css('display', 'block');
1449
  if (option == 'products_atleast_one' || option == 'products_not_in') {
1450
  processShowOnlyTags('product_div_', id);
1451
+ } else if (option == 'categories_atleast_one' || option == 'categories_in' || option == 'in_each_category' || option == 'exclude_categories' || option == 'atleast_one_including_sub_categories') {
1452
  processShowOnlyTags('category_div_', id);
1453
  } else if (option == 'coupon_applied_any_one' || option == 'coupon_applied_all_selected') {
1454
  processShowOnlyTags('coupon_div_', id);
1463
  } else if (option == 'exclude_sale_products') {
1464
  $('.value_text_'+id).css('display', 'none');
1465
  processShowOnlyTags('exclude_on_sale_products_div_', id);
1466
+ } else if (option == 'customer_based_on_first_order') {
1467
+ processShowOnlyTags('general_', id);
1468
+ $('.value_text_'+id).css('display', 'none');
1469
+ $('#general_'+id).css('display', 'none');
1470
  } else if (option == 'customer_based_on_purchase_history' || option == 'customer_based_on_purchase_history_product_order_count' || option == 'customer_based_on_purchase_history_order_count' || option == 'customer_based_on_purchase_history_product_quantity_count') {
1471
  processShowOnlyTags('purchase_history_div_', id);
1472
  if(option == 'customer_based_on_purchase_history_product_order_count' || option == 'customer_based_on_purchase_history_product_quantity_count'){
1488
  }, 2000);
1489
  }
1490
 
1491
+ function woo_discount_rule_error_notice(message) {
1492
+ jQuery('#woo-admin-message').html(' <div class="notice notice-error is-dismissable"><p>'+message+'</p></div>');
1493
+
1494
+ setTimeout(function () {
1495
+ jQuery('#woo-admin-message').html('');
1496
+ }, 2000);
1497
+ }
1498
+
1499
  function makeActiveForSelectedTab(selected){
1500
  var container = selected.closest('.nav-tab-wrapper');
1501
  container.find('.nav-tab').removeClass('nav-tab-active');
assets/js/woo_discount_rules.js CHANGED
@@ -69,4 +69,12 @@ jQuery( document ).ready( function() {
69
  jQuery( ".single_variation_wrap" ).on( "show_variation, woo_discount_rules_after_variant_strikeout", function ( event, variation ) {
70
  jQuery(this).closest('form').find('input[name="quantity"]').trigger('change');
71
  });
 
 
 
 
 
 
 
 
72
  });
69
  jQuery( ".single_variation_wrap" ).on( "show_variation, woo_discount_rules_after_variant_strikeout", function ( event, variation ) {
70
  jQuery(this).closest('form').find('input[name="quantity"]').trigger('change');
71
  });
72
+ jQuery(document).on('mouseenter', '.wdr_table_container', function () {
73
+ jQuery('.wdr_table_container .wdr_table_off_settings_link_con').show();
74
+ jQuery('.wdr_table_container_for_admin').addClass('wdr_table_cbr');
75
+ });
76
+ jQuery(document).on('mouseleave', '.wdr_table_container', function () {
77
+ jQuery('.wdr_table_container .wdr_table_off_settings_link_con').hide();
78
+ jQuery('.wdr_table_container_for_admin').removeClass('wdr_table_cbr');
79
+ });
80
  });
helper/general-helper.php CHANGED
@@ -535,6 +535,32 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
535
  return $coupons;
536
  }
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  /**
539
  * Get Current date and time based on Wordpress time zone
540
  *
@@ -988,5 +1014,113 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
988
 
989
  return $show;
990
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  }
992
  }
535
  return $coupons;
536
  }
537
 
538
+ /**
539
+ * get Used Coupons
540
+ * */
541
+ public static function getDynamicUsedCouponsInRules(){
542
+ $coupons = array();
543
+ $post_args = array('post_type' => array('woo_discount', 'woo_discount_cart'), 'numberposts' => '-1', 'post_status' => 'publish');
544
+ $post_args['meta_key'] = 'dynamic_coupons_to_apply';
545
+ $post_args['meta_query'] = array(
546
+ array(
547
+ 'key' => 'status',
548
+ 'value' => 'publish',
549
+ )
550
+ );
551
+ $posts = get_posts($post_args);
552
+ if(!empty($posts) && count($posts) > 0){
553
+ foreach ($posts as $post){
554
+ $used_coupons = get_post_meta($post->ID, 'dynamic_coupons_to_apply');
555
+ if(!empty($used_coupons)){
556
+ $coupons = array_merge($coupons, $used_coupons);
557
+ }
558
+ }
559
+ }
560
+
561
+ return $coupons;
562
+ }
563
+
564
  /**
565
  * Get Current date and time based on Wordpress time zone
566
  *
1014
 
1015
  return $show;
1016
  }
1017
+
1018
+ /**
1019
+ * Validate coupon
1020
+ *
1021
+ * @param string $coupon_name
1022
+ * @return array
1023
+ * */
1024
+ public static function validateDynamicCoupon($coupon_name){
1025
+ $result['status'] = false;
1026
+ $coupon_name = self::filterDynamicCoupon($coupon_name);
1027
+ if(!empty($coupon_name)){
1028
+ $coupon_exists = self::checkCouponAlreadyExistsInWooCommerce($coupon_name);
1029
+ if($coupon_exists){
1030
+ $result['status'] = false;
1031
+ $result['message'] = esc_html__('Coupon already exists in WooCommerce. Please select another name', 'woo-discount-rules');
1032
+ } else {
1033
+ $result['status'] = true;
1034
+ }
1035
+ }
1036
+ $result['coupon'] = $coupon_name;
1037
+
1038
+ return $result;
1039
+ }
1040
+
1041
+ /**
1042
+ * Validate coupon
1043
+ *
1044
+ * @param string $coupon_name
1045
+ * @return boolean
1046
+ * */
1047
+ public static function checkCouponAlreadyExistsInWooCommerce($coupon_name){
1048
+ $coupon_args = array(
1049
+ 'name' => wc_strtolower($coupon_name),
1050
+ 'post_type' => 'shop_coupon'
1051
+ );
1052
+ $posts = get_posts($coupon_args);
1053
+ if(!empty($posts) && count($posts) > 0){
1054
+ return true;
1055
+ }
1056
+
1057
+ return false;
1058
+ }
1059
+
1060
+ /**
1061
+ * Filter Coupon name
1062
+ *
1063
+ * @param string $coupon_name
1064
+ * @return string
1065
+ * */
1066
+ public static function filterDynamicCoupon($coupon_name){
1067
+ $coupon_name = trim($coupon_name);
1068
+ $coupon_name = str_replace(' ', '', $coupon_name);
1069
+ $coupon_name = apply_filters('woocommerce_coupon_code', $coupon_name);
1070
+ $coupon_name = wc_strtoupper($coupon_name);
1071
+
1072
+ return $coupon_name;
1073
+ }
1074
+
1075
+ /**
1076
+ * Virtually add Coupon to apply the Discount.
1077
+ *
1078
+ * @param array $response
1079
+ * @param mixed $coupon_data
1080
+ * @return mixed
1081
+ */
1082
+ public static function addVirtualCoupon($response, $coupon_data)
1083
+ {
1084
+ if(is_string($coupon_data)){
1085
+ $used_coupon_codes = self::getDynamicUsedCouponsInRules();
1086
+ // Getting Coupon Remove status from Session.
1087
+ $is_removed = WC()->session->get('woo_coupon_removed');
1088
+ // If Both are same, then it won't added.
1089
+ if (in_array(wc_strtoupper($is_removed), $used_coupon_codes)) return $response;
1090
+ if (in_array(wc_strtoupper($coupon_data), $used_coupon_codes)) {
1091
+ $discount_type = 'percent';
1092
+ $amount = 0;
1093
+
1094
+ $coupon = array(
1095
+ 'id' => time() . rand(2, 9),
1096
+ 'amount' => $amount,
1097
+ 'individual_use' => false,
1098
+ 'product_ids' => array(),
1099
+ 'exclude_product_ids' => array(),
1100
+ 'usage_limit' => '',
1101
+ 'usage_limit_per_user' => '',
1102
+ 'limit_usage_to_x_items' => '',
1103
+ 'usage_count' => '',
1104
+ 'expiry_date' => '',
1105
+ 'apply_before_tax' => 'yes',
1106
+ 'free_shipping' => false,
1107
+ 'product_categories' => array(),
1108
+ 'exclude_product_categories' => array(),
1109
+ 'exclude_sale_items' => false,
1110
+ 'minimum_amount' => '',
1111
+ 'maximum_amount' => '',
1112
+ 'customer_email' => '',
1113
+ );
1114
+ if(FlycartWoocommerceVersion::wcVersion('3.2')) {
1115
+ $coupon['discount_type'] = $discount_type;
1116
+ } else {
1117
+ $coupon['type'] = $discount_type;
1118
+ }
1119
+ return $coupon;
1120
+ }
1121
+ }
1122
+
1123
+ return $response;
1124
+ }
1125
  }
1126
  }
i18n/languages/woo-discount-rules.pot CHANGED
@@ -15,34 +15,39 @@ msgstr ""
15
  msgid "Guest"
16
  msgstr ""
17
 
18
- #: helper/general-helper.php:588
19
  msgid "Start date and time is set in the future date"
20
  msgstr ""
21
 
22
- #: helper/general-helper.php:591
23
  msgid "Validity expired"
24
  msgstr ""
25
 
26
- #: helper/general-helper.php:608
27
  msgid "Will run in future"
28
  msgstr ""
29
 
30
- #: helper/general-helper.php:611
31
  msgid "Not running - validity expired"
32
  msgstr ""
33
 
34
- #: helper/general-helper.php:628
35
  msgid "Running"
36
  msgstr ""
37
 
38
- #: helper/general-helper.php:633
39
  msgid "Your server current date and time: "
40
  msgstr ""
41
 
42
- #: helper/general-helper.php:768
43
  msgid "Read Docs"
44
  msgstr ""
45
 
 
 
 
 
 
46
  #: helper/purchase.php:25 view/includes/cart-menu.php:5
47
  #: view/includes/menu.php:6 view/includes/sub-menu.php:5
48
  msgid "Woo Discount Rules"
@@ -143,6 +148,14 @@ msgstr ""
143
  msgid "Title to be display on site"
144
  msgstr ""
145
 
 
 
 
 
 
 
 
 
146
  #: includes/discount-base.php:195 view/cart-rules.php:147
147
  #: view/pricing-rules.php:177
148
  msgid "Active"
@@ -214,32 +227,32 @@ msgstr ""
214
  msgid "Please enter a Key"
215
  msgstr ""
216
 
217
- #: includes/discount-base.php:1009 view/view-pricing-rules.php:683
218
  msgid "Min Quantity"
219
  msgstr ""
220
 
221
- #: includes/discount-base.php:1010 view/view-pricing-rules.php:690
222
  msgid "Max Quantity"
223
  msgstr ""
224
 
225
- #: includes/discount-base.php:1011 view/view-pricing-rules.php:598
226
- #: view/view-pricing-rules.php:601 view/view-pricing-rules.php:621
227
  msgid "Quantity"
228
  msgstr ""
229
 
230
  #: includes/discount-base.php:1012 view/view-cart-rules.php:92
231
- #: view/view-pricing-rules.php:74 view/view-pricing-rules.php:688
232
- #: view/view-pricing-rules.php:779 view/view-pricing-rules.php:796
233
- #: view/view-pricing-rules.php:803
234
  msgid "ex. 1"
235
  msgstr ""
236
 
237
- #: includes/discount-base.php:1013 view/view-pricing-rules.php:841
238
  msgid "ex. 10"
239
  msgstr ""
240
 
241
- #: includes/discount-base.php:1014 view/view-pricing-rules.php:695
242
- #: view/view-pricing-rules.php:755
243
  msgid "ex. 50"
244
  msgstr ""
245
 
@@ -247,27 +260,27 @@ msgstr ""
247
  msgid "Search for a user"
248
  msgstr ""
249
 
250
- #: includes/discount-base.php:1016 view/view-pricing-rules.php:696
251
  msgid "Adjustment Type"
252
  msgstr ""
253
 
254
- #: includes/discount-base.php:1017 view/view-pricing-rules.php:830
255
  msgid "Discount percentage"
256
  msgstr ""
257
 
258
- #: includes/discount-base.php:1018 view/view-cart-rules.php:700
259
- #: view/view-pricing-rules.php:702
260
  msgid "Percentage Discount"
261
  msgstr ""
262
 
263
- #: includes/discount-base.php:1019 view/view-cart-rules.php:706
264
- #: view/view-cart-rules.php:708 view/view-pricing-rules.php:710
265
- #: view/view-pricing-rules.php:712
266
  msgid "Price Discount"
267
  msgstr ""
268
 
269
- #: includes/discount-base.php:1020 view/view-pricing-rules.php:740
270
- #: view/view-pricing-rules.php:742
271
  msgid "BOGO Product Discount"
272
  msgstr ""
273
 
@@ -275,78 +288,78 @@ msgstr ""
275
  msgid "Product Discount - Not support for subtotal based rule"
276
  msgstr ""
277
 
278
- #: includes/discount-base.php:1022 view/view-cart-rules.php:436
279
- #: view/view-pricing-rules.php:750 view/view-pricing-rules.php:890
280
  msgid "Value"
281
  msgstr ""
282
 
283
- #: includes/discount-base.php:1023 view/view-pricing-rules.php:762
284
  msgid "receive discount for"
285
  msgstr ""
286
 
287
- #: includes/discount-base.php:1024 view/view-pricing-rules.php:764
288
  msgid "Auto add all selected products"
289
  msgstr ""
290
 
291
- #: includes/discount-base.php:1025 view/view-pricing-rules.php:765
292
  msgid "Same product"
293
  msgstr ""
294
 
295
- #: includes/discount-base.php:1026 view/view-pricing-rules.php:766
296
  msgid "Any one cheapest from selected"
297
  msgstr ""
298
 
299
- #: includes/discount-base.php:1027 view/view-pricing-rules.php:767
300
  msgid "Any one cheapest from all products"
301
  msgstr ""
302
 
303
- #: includes/discount-base.php:1028 view/view-pricing-rules.php:768
304
  msgid "Cheapest in cart - selected category(ies)"
305
  msgstr ""
306
 
307
- #: includes/discount-base.php:1029 view/view-pricing-rules.php:769
308
  msgid "Cheapest in cart - selected item(s)"
309
  msgstr ""
310
 
311
- #: includes/discount-base.php:1030 view/view-pricing-rules.php:770
312
  msgid "Cheapest among all items in cart"
313
  msgstr ""
314
 
315
- #: includes/discount-base.php:1031 view/view-pricing-rules.php:774
316
  msgid "Free quantity"
317
  msgstr ""
318
 
319
- #: includes/discount-base.php:1032 view/view-pricing-rules.php:774
320
  msgid "Number of quantity(ies) in each selected product(s)"
321
  msgstr ""
322
 
323
- #: includes/discount-base.php:1033 view/view-pricing-rules.php:788
324
  msgid "Fixed item count (not recommended)"
325
  msgstr ""
326
 
327
- #: includes/discount-base.php:1034 view/view-pricing-rules.php:787
328
  msgid "Dynamic item count"
329
  msgstr ""
330
 
331
- #: includes/discount-base.php:1035 view/view-pricing-rules.php:790
332
  msgid ""
333
  "Fixed item count - You need to provide item count manually. Dynamic item "
334
  "count - System will choose dynamically based on cart"
335
  msgstr ""
336
 
337
- #: includes/discount-base.php:1036 view/view-pricing-rules.php:791
338
  msgid "Item count"
339
  msgstr ""
340
 
341
- #: includes/discount-base.php:1037 view/view-pricing-rules.php:791
342
  msgid "Discount for number of item(s) in cart"
343
  msgstr ""
344
 
345
- #: includes/discount-base.php:1038 view/view-pricing-rules.php:798
346
- msgid "Discount for number of quantity(ies) in each item"
347
  msgstr ""
348
 
349
- #: includes/discount-base.php:1039 view/view-pricing-rules.php:798
350
  msgid "Item quantity"
351
  msgstr ""
352
 
@@ -358,11 +371,11 @@ msgstr ""
358
  msgid "and"
359
  msgstr ""
360
 
361
- #: includes/discount-base.php:1042 view/view-pricing-rules.php:832
362
  msgid "100% percent"
363
  msgstr ""
364
 
365
- #: includes/discount-base.php:1043 view/view-pricing-rules.php:833
366
  msgid "Limited percent"
367
  msgstr ""
368
 
@@ -374,13 +387,13 @@ msgstr ""
374
  msgid "as discount"
375
  msgstr ""
376
 
377
- #: includes/discount-base.php:1046 view/view-cart-rules.php:663
378
- #: view/view-pricing-rules.php:847
379
  msgid "Remove"
380
  msgstr ""
381
 
382
  #: includes/discount-base.php:1047 view/cart-rules.php:170
383
- #: view/pricing-rules.php:200 view/view-pricing-rules.php:850
384
  msgid "Duplicate"
385
  msgstr ""
386
 
@@ -451,26 +464,26 @@ msgstr ""
451
  msgid "Including sub-categories in cart"
452
  msgstr ""
453
 
454
- #: includes/discount-base.php:1065 view/view-cart-rules.php:261
455
  msgid "Customer Details (must be logged in)"
456
  msgstr ""
457
 
458
- #: includes/discount-base.php:1066 view/view-cart-rules.php:267
459
- #: view/view-cart-rules.php:269
460
  msgid "User in list"
461
  msgstr ""
462
 
463
- #: includes/discount-base.php:1067 view/view-cart-rules.php:277
464
- #: view/view-cart-rules.php:279
465
  msgid "User role in list"
466
  msgstr ""
467
 
468
- #: includes/discount-base.php:1068 view/view-cart-rules.php:343
469
- #: view/view-cart-rules.php:345
470
  msgid "Shipping country in list"
471
  msgstr ""
472
 
473
- #: includes/discount-base.php:1069 view/view-cart-rules.php:283
474
  msgid "Customer Email"
475
  msgstr ""
476
 
@@ -478,178 +491,183 @@ msgstr ""
478
  msgid "Email with TLD (Ege: edu)"
479
  msgstr ""
480
 
481
- #: includes/discount-base.php:1071 view/view-cart-rules.php:299
482
- #: view/view-cart-rules.php:301
483
  msgid "Email with Domain (Eg: gmail.com)"
484
  msgstr ""
485
 
486
- #: includes/discount-base.php:1072 view/view-cart-rules.php:305
487
  msgid "Customer Billing Details"
488
  msgstr ""
489
 
490
- #: includes/discount-base.php:1073 view/view-cart-rules.php:311
491
- #: view/view-cart-rules.php:313
492
  msgid "Billing city"
493
  msgstr ""
494
 
495
- #: includes/discount-base.php:1074 view/view-cart-rules.php:317
496
  msgid "Customer Shipping Details"
497
  msgstr ""
498
 
499
- #: includes/discount-base.php:1075 view/view-cart-rules.php:333
500
- #: view/view-cart-rules.php:335
501
  msgid "Shipping state"
502
  msgstr ""
503
 
504
- #: includes/discount-base.php:1076 view/view-cart-rules.php:323
505
- #: view/view-cart-rules.php:325
506
  msgid "Shipping city"
507
  msgstr ""
508
 
509
- #: includes/discount-base.php:1077 view/view-cart-rules.php:353
510
- #: view/view-cart-rules.php:355
511
  msgid "Shipping zip code"
512
  msgstr ""
513
 
514
- #: includes/discount-base.php:1078 view/view-cart-rules.php:359
515
- #: view/view-pricing-rules.php:486
516
  msgid "Purchase History"
517
  msgstr ""
518
 
519
- #: includes/discount-base.php:1079 view/view-cart-rules.php:365
520
- #: view/view-cart-rules.php:367 view/view-pricing-rules.php:494
521
  msgid "Purchased amount"
522
  msgstr ""
523
 
524
- #: includes/discount-base.php:1080 view/view-cart-rules.php:375
525
- #: view/view-cart-rules.php:377 view/view-pricing-rules.php:495
526
  msgid "Number of previous orders made"
527
  msgstr ""
528
 
529
- #: includes/discount-base.php:1081 view/view-cart-rules.php:385
530
- #: view/view-cart-rules.php:387 view/view-pricing-rules.php:496
531
  msgid "Number of previous orders made with following products"
532
  msgstr ""
533
 
534
- #: includes/discount-base.php:1082 view/view-cart-rules.php:395
535
- #: view/view-cart-rules.php:397 view/view-pricing-rules.php:497
536
  msgid "Number of quantity(s) in previous orders made with following products"
537
  msgstr ""
538
 
539
- #: includes/discount-base.php:1083 view/view-cart-rules.php:401
540
  msgid "Coupon applied"
541
  msgstr ""
542
 
543
- #: includes/discount-base.php:1084 view/view-cart-rules.php:407
544
- #: view/view-cart-rules.php:409
545
- msgid "Atleast any one"
 
 
 
 
 
546
  msgstr ""
547
 
548
- #: includes/discount-base.php:1085 view/view-cart-rules.php:417
549
- #: view/view-cart-rules.php:419
550
- msgid "All selected"
551
  msgstr ""
552
 
553
- #: includes/discount-base.php:1086 view/view-cart-rules.php:618
554
- #: view/view-pricing-rules.php:534
555
  msgid "Greater than or equal to"
556
  msgstr ""
557
 
558
- #: includes/discount-base.php:1087 view/view-cart-rules.php:619
559
- #: view/view-pricing-rules.php:535 view/view-pricing-rules.php:594
560
  msgid "Less than or equal to"
561
  msgstr ""
562
 
563
- #: includes/discount-base.php:1088 view/view-cart-rules.php:621
564
- #: view/view-pricing-rules.php:538
565
  msgid "and the order status should be"
566
  msgstr ""
567
 
568
- #: includes/discount-base.php:1089 view/cart-rules.php:114
569
  #: view/cart-rules.php:209 view/pricing-rules.php:144
570
- #: view/pricing-rules.php:239 view/view-cart-rules.php:662
571
  msgid "Action"
572
  msgstr ""
573
 
574
- #: includes/discount-base.php:1090 view/settings.php:21
575
  #: view/settings_taxonomy.php:21
576
  msgid "Save"
577
  msgstr ""
578
 
579
- #: includes/discount-base.php:1091
580
  msgid "Saved Successfully!"
581
  msgstr ""
582
 
583
- #: includes/discount-base.php:1092 view/view-cart-rules.php:465
584
- #: view/view-cart-rules.php:533 view/view-cart-rules.php:553
585
- #: view/view-cart-rules.php:574 view/view-cart-rules.php:626
586
  #: view/view-pricing-rules.php:235 view/view-pricing-rules.php:251
587
- #: view/view-pricing-rules.php:546 view/view-pricing-rules.php:630
588
- #: view/view-pricing-rules.php:818
589
  msgid "None selected"
590
  msgstr ""
591
 
592
- #: includes/discount-base.php:1093 view/view-cart-rules.php:258
593
  msgid "In each category"
594
  msgstr ""
595
 
596
- #: includes/discount-base.php:1094 view/settings_price_rules.php:208
597
  #: view/settings_price_rules.php:226 view/settings_price_rules.php:244
598
  #: view/settings_price_rules.php:262
599
  msgid "Show"
600
  msgstr ""
601
 
602
- #: includes/discount-base.php:1095 view/template/sidebar.php:12
603
  msgid "Hide"
604
  msgstr ""
605
 
606
- #: includes/discount-base.php:1096
607
  msgid "Please select at least one rule"
608
  msgstr ""
609
 
610
- #: includes/discount-base.php:1097
611
  msgid "Please select an action to apply"
612
  msgstr ""
613
 
614
- #: includes/discount-base.php:1098
615
  msgid "Are you sure to remove the selected rules"
616
  msgstr ""
617
 
618
- #: includes/discount-base.php:1099 view/view-pricing-rules.php:807
619
  msgid "Choose product(s)"
620
  msgstr ""
621
 
622
- #: includes/discount-base.php:1100 view/view-pricing-rules.php:817
623
  msgid "Choose category(ies)"
624
  msgstr ""
625
 
626
- #: includes/discount-base.php:1101
627
  msgid "Search for a coupon"
628
  msgstr ""
629
 
630
- #: includes/discount-base.php:1102 view/view-pricing-rules.php:841
631
  #, php-format
632
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
633
  msgstr ""
634
 
635
- #: includes/discount-base.php:1103
636
  #, php-format
637
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
638
  msgstr ""
639
 
640
- #: includes/discount-base.php:1104
641
  #, php-format
642
  msgid "Enter the discounted price per unit. Eg: <b>10</b> for %s as unit price"
643
  msgstr ""
644
 
645
- #: includes/discount-base.php:1105
646
  #, php-format
647
  msgid ""
648
  "Enter the price for selected quantity. Eg: <b>10</b> then %s as total price "
649
  "for selected quantity"
650
  msgstr ""
651
 
652
- #: includes/discount-base.php:1106 view/view-pricing-rules.php:772
653
  msgid ""
654
  "Auto add all selected products - Automatically added to the cart <br> Same "
655
  "product - get discount in same product <br> Any one cheapest from selected - "
@@ -660,186 +678,195 @@ msgid ""
660
  "no.of quantities"
661
  msgstr ""
662
 
663
- #: includes/discount-base.php:1107 view/view-cart-rules.php:221
664
  msgid "Products"
665
  msgstr ""
666
 
667
- #: includes/discount-base.php:1108 view/view-cart-rules.php:226
668
  msgid "Products in cart"
669
  msgstr ""
670
 
671
- #: includes/discount-base.php:1109 view/view-cart-rules.php:232
672
  #: view/view-pricing-rules.php:270
673
  msgid "Exclude products"
674
  msgstr ""
675
 
676
- #: includes/discount-base.php:1110 view/view-cart-rules.php:238
677
  msgid "Exclude on sale products"
678
  msgstr ""
679
 
680
- #: includes/discount-base.php:1111 view/view-cart-rules.php:503
681
  msgid "This will exclude the on sale products from discount"
682
  msgstr ""
683
 
684
- #: includes/discount-base.php:1112 view/view-cart-rules.php:634
685
- #: view/view-pricing-rules.php:553
686
  msgid "From all previous orders"
687
  msgstr ""
688
 
689
- #: includes/discount-base.php:1113 view/view-cart-rules.php:635
690
- #: view/view-pricing-rules.php:554
691
  msgid "Last 7 days"
692
  msgstr ""
693
 
694
- #: includes/discount-base.php:1114 view/view-cart-rules.php:636
695
- #: view/view-pricing-rules.php:555
696
  msgid "Last 14 days"
697
  msgstr ""
698
 
699
- #: includes/discount-base.php:1115 view/view-cart-rules.php:637
700
- #: view/view-pricing-rules.php:556
701
  msgid "Last 30 days"
702
  msgstr ""
703
 
704
- #: includes/discount-base.php:1116 view/view-cart-rules.php:638
705
- #: view/view-pricing-rules.php:557
706
  msgid "Last 60 days"
707
  msgstr ""
708
 
709
- #: includes/discount-base.php:1117 view/view-cart-rules.php:639
710
- #: view/view-pricing-rules.php:558
711
  msgid "Last 90 days"
712
  msgstr ""
713
 
714
- #: includes/discount-base.php:1118 view/view-cart-rules.php:640
715
- #: view/view-pricing-rules.php:559
716
  msgid "Last 180 days"
717
  msgstr ""
718
 
719
- #: includes/discount-base.php:1119 view/view-cart-rules.php:641
720
- #: view/view-pricing-rules.php:560
721
  msgid "Last 1 year"
722
  msgstr ""
723
 
724
- #: includes/discount-base.php:1120 view/view-cart-rules.php:642
725
- #: view/view-pricing-rules.php:561
726
  msgid "Custom"
727
  msgstr ""
728
 
729
- #: includes/discount-base.php:1121 view/view-cart-rules.php:645
730
- #: view/view-pricing-rules.php:565
731
  msgid "in days"
732
  msgstr ""
733
 
734
- #: includes/discount-base.php:1122 view/view-pricing-rules.php:720
735
- #: view/view-pricing-rules.php:722
736
  msgid "Fixed Price Per Unit"
737
  msgstr ""
738
 
739
- #: includes/discount-base.php:1123 view/view-pricing-rules.php:730
740
- #: view/view-pricing-rules.php:732
741
  msgid "Bundle (Set) Discount"
742
  msgstr ""
743
 
744
- #: includes/discount-base.php:1201 view/includes/menu.php:13
 
 
 
 
 
 
 
 
 
745
  msgid "Settings"
746
  msgstr ""
747
 
748
- #: includes/pricing-rules.php:3046 view/view-pricing-rules.php:586
749
  msgid "Buy"
750
  msgstr ""
751
 
752
- #: includes/pricing-rules.php:3050
753
  msgid " less than or equal to "
754
  msgstr ""
755
 
756
- #: includes/pricing-rules.php:3050 includes/pricing-rules.php:3056
757
  msgid " Quantity"
758
  msgstr ""
759
 
760
- #: includes/pricing-rules.php:3053
761
  msgid " Quantity "
762
  msgstr ""
763
 
764
- #: includes/pricing-rules.php:3060
765
  msgid " or more Quantity"
766
  msgstr ""
767
 
768
- #: includes/pricing-rules.php:3069
769
  msgid " any "
770
  msgstr ""
771
 
772
- #: includes/pricing-rules.php:3069
773
  msgid " products from "
774
  msgstr ""
775
 
776
- #: includes/pricing-rules.php:3076
777
  msgid " in each products"
778
  msgstr ""
779
 
780
- #: includes/pricing-rules.php:3088
781
  msgid " and get discount on "
782
  msgstr ""
783
 
784
- #: includes/pricing-rules.php:3091
785
  msgid " first "
786
  msgstr ""
787
 
788
- #: includes/pricing-rules.php:3093 includes/pricing-rules.php:3097
789
  msgid " quantity of product(s) - "
790
  msgstr ""
791
 
792
- #: includes/pricing-rules.php:3095
793
  msgid " after first "
794
  msgstr ""
795
 
796
- #: includes/pricing-rules.php:3113
797
  msgid "Category(ies) "
798
  msgstr ""
799
 
800
- #: includes/pricing-rules.php:3184
801
  msgid "Get "
802
  msgstr ""
803
 
804
- #: includes/pricing-rules.php:3186
805
  #, php-format
806
  msgid "% discount in "
807
  msgstr ""
808
 
809
- #: includes/pricing-rules.php:3189
810
  msgid "same product"
811
  msgstr ""
812
 
813
- #: includes/pricing-rules.php:3191
814
  msgid "any cheapest one from cart"
815
  msgstr ""
816
 
817
- #: includes/pricing-rules.php:3194
818
  msgid "any cheapest one of "
819
  msgstr ""
820
 
821
- #: includes/pricing-rules.php:3199
822
  msgid " quantity of any "
823
  msgstr ""
824
 
825
- #: includes/pricing-rules.php:3201
826
  msgid " cheapest item "
827
  msgstr ""
828
 
829
- #: includes/pricing-rules.php:3204
830
  msgid " quantity of cheapest item "
831
  msgstr ""
832
 
833
- #: includes/pricing-rules.php:3208
834
  msgid "from the category "
835
  msgstr ""
836
 
837
- #: includes/pricing-rules.php:3230
838
  #, php-format
839
  msgid "%s for %s Quantity(s)"
840
  msgstr ""
841
 
842
- #: includes/pricing-rules.php:3232
843
  #, php-format
844
  msgid "%s as price per unit"
845
  msgstr ""
@@ -958,7 +985,7 @@ msgid "Apply"
958
  msgstr ""
959
 
960
  #: view/cart-rules.php:98 view/cart-rules.php:193 view/pricing-rules.php:128
961
- #: view/pricing-rules.php:223 view/template/discount-table.php:21
962
  msgid "Name"
963
  msgstr ""
964
 
@@ -1119,7 +1146,7 @@ msgid ""
1119
  msgstr ""
1120
 
1121
  #: view/includes/cart-menu.php:9 view/includes/sub-menu.php:9
1122
- #: view/settings.php:26 view/view-cart-rules.php:65
1123
  #: view/view-pricing-rules.php:47
1124
  msgid "General"
1125
  msgstr ""
@@ -1129,8 +1156,8 @@ msgid "Conditions"
1129
  msgstr ""
1130
 
1131
  #: view/includes/cart-menu.php:13 view/includes/sub-menu.php:13
1132
- #: view/template/discount-table.php:27 view/view-cart-rules.php:680
1133
- #: view/view-pricing-rules.php:652
1134
  msgid "Discount"
1135
  msgstr ""
1136
 
@@ -1175,19 +1202,19 @@ msgstr ""
1175
  msgid "Price Rules"
1176
  msgstr ""
1177
 
1178
- #: view/settings.php:27
1179
  msgid "Price rules"
1180
  msgstr ""
1181
 
1182
- #: view/settings.php:28
1183
  msgid "Cart rules"
1184
  msgstr ""
1185
 
1186
- #: view/settings.php:29
1187
  msgid "Performance"
1188
  msgstr ""
1189
 
1190
- #: view/settings.php:30
1191
  msgid "Promotion"
1192
  msgstr ""
1193
 
@@ -1245,8 +1272,8 @@ msgstr ""
1245
 
1246
  #: view/settings_cart_rules.php:92 view/settings_price_rules.php:313
1247
  #: view/view-pricing-rules.php:300 view/view-pricing-rules.php:357
1248
- #: view/view-pricing-rules.php:427 view/view-pricing-rules.php:475
1249
- #: view/view-pricing-rules.php:505
1250
  msgid "Supported in PRO version"
1251
  msgstr ""
1252
 
@@ -1590,11 +1617,19 @@ msgid ""
1590
  "More examples can be found in the documentation"
1591
  msgstr ""
1592
 
1593
- #: view/template/discount-table.php:24
 
 
 
 
 
 
 
 
1594
  msgid "Range"
1595
  msgstr ""
1596
 
1597
- #: view/template/discount-table.php:59
1598
  msgid "No Active Discounts."
1599
  msgstr ""
1600
 
@@ -1716,7 +1751,7 @@ msgid "Period of Rule Active. Format: month/day/Year Hour:Min"
1716
  msgstr ""
1717
 
1718
  #: view/view-cart-rules.php:135 view/view-pricing-rules.php:144
1719
- #: view/view-pricing-rules.php:596
1720
  msgid "From"
1721
  msgstr ""
1722
 
@@ -1729,8 +1764,8 @@ msgstr ""
1729
  msgid "Current date and time: %s"
1730
  msgstr ""
1731
 
1732
- #: view/view-cart-rules.php:145 view/view-cart-rules.php:674
1733
- #: view/view-pricing-rules.php:183 view/view-pricing-rules.php:645
1734
  msgid "Next"
1735
  msgstr ""
1736
 
@@ -1746,40 +1781,40 @@ msgstr ""
1746
  msgid "Categories In Cart"
1747
  msgstr ""
1748
 
1749
- #: view/view-cart-rules.php:289 view/view-cart-rules.php:291
1750
  msgid "Email with TLD (Eg: edu)"
1751
  msgstr ""
1752
 
1753
- #: view/view-cart-rules.php:673 view/view-cart-rules.php:770
1754
- #: view/view-pricing-rules.php:644 view/view-pricing-rules.php:895
1755
  msgid "Previous"
1756
  msgstr ""
1757
 
1758
- #: view/view-cart-rules.php:676
1759
  msgid "Guide to create cart rules"
1760
  msgstr ""
1761
 
1762
- #: view/view-cart-rules.php:696
1763
  msgid "Discount Type :"
1764
  msgstr ""
1765
 
1766
- #: view/view-cart-rules.php:715 view/view-cart-rules.php:717
1767
  msgid "Product Discount"
1768
  msgstr ""
1769
 
1770
- #: view/view-cart-rules.php:724 view/view-cart-rules.php:726
1771
  msgid "Free shipping"
1772
  msgstr ""
1773
 
1774
- #: view/view-cart-rules.php:735
1775
  msgid "value :"
1776
  msgstr ""
1777
 
1778
- #: view/view-cart-rules.php:743
1779
  msgid "Select products :"
1780
  msgstr ""
1781
 
1782
- #: view/view-cart-rules.php:757
1783
  msgid "Quantity :"
1784
  msgstr ""
1785
 
@@ -1914,7 +1949,7 @@ msgstr ""
1914
  msgid "Customers"
1915
  msgstr ""
1916
 
1917
- #: view/view-pricing-rules.php:318 view/view-pricing-rules.php:617
1918
  msgid "All"
1919
  msgstr ""
1920
 
@@ -1926,8 +1961,8 @@ msgstr ""
1926
  msgid "User roles"
1927
  msgstr ""
1928
 
1929
- #: view/view-pricing-rules.php:346 view/view-pricing-rules.php:376
1930
- #: view/view-pricing-rules.php:450 view/view-pricing-rules.php:493
1931
  msgid "Do not use"
1932
  msgstr ""
1933
 
@@ -1935,110 +1970,110 @@ msgstr ""
1935
  msgid "Coupon"
1936
  msgstr ""
1937
 
1938
- #: view/view-pricing-rules.php:377
1939
- msgid "Apply if any one coupon applied"
1940
  msgstr ""
1941
 
1942
- #: view/view-pricing-rules.php:378
1943
- msgid "Apply if all coupon applied"
1944
  msgstr ""
1945
 
1946
- #: view/view-pricing-rules.php:417
1947
  msgid "Make sure you have created the coupon already"
1948
  msgstr ""
1949
 
1950
- #: view/view-pricing-rules.php:438
1951
  msgid "Subtotal"
1952
  msgstr ""
1953
 
1954
- #: view/view-pricing-rules.php:439
1955
  msgid "Applies for the whole cart subtotal (not recommended)."
1956
  msgstr ""
1957
 
1958
- #: view/view-pricing-rules.php:451
1959
  msgid "Subtotal atleast"
1960
  msgstr ""
1961
 
1962
- #: view/view-pricing-rules.php:456
1963
  msgid "Enter the amount"
1964
  msgstr ""
1965
 
1966
- #: view/view-pricing-rules.php:466
1967
  msgid "Supported in WooCommerce 3.x"
1968
  msgstr ""
1969
 
1970
- #: view/view-pricing-rules.php:588
1971
  msgid "Any"
1972
  msgstr ""
1973
 
1974
- #: view/view-pricing-rules.php:589
1975
  msgid "Each"
1976
  msgstr ""
1977
 
1978
- #: view/view-pricing-rules.php:590
1979
  msgid "Combine"
1980
  msgstr ""
1981
 
1982
- #: view/view-pricing-rules.php:593
1983
  msgid "More than or equal to"
1984
  msgstr ""
1985
 
1986
- #: view/view-pricing-rules.php:595
1987
  msgid "Equal"
1988
  msgstr ""
1989
 
1990
- #: view/view-pricing-rules.php:600
1991
  msgid "to"
1992
  msgstr ""
1993
 
1994
- #: view/view-pricing-rules.php:604
1995
  msgid "Product(s) from"
1996
  msgstr ""
1997
 
1998
- #: view/view-pricing-rules.php:610
1999
  msgid "Apply discount in product(s)"
2000
  msgstr ""
2001
 
2002
- #: view/view-pricing-rules.php:611
2003
  msgid "Apply discount in category(ies)"
2004
  msgstr ""
2005
 
2006
- #: view/view-pricing-rules.php:615
2007
  msgid "and get discount on "
2008
  msgstr ""
2009
 
2010
- #: view/view-pricing-rules.php:618
2011
  msgid "First quantity(s)"
2012
  msgstr ""
2013
 
2014
- #: view/view-pricing-rules.php:619
2015
  msgid "Skip first quantity(s)"
2016
  msgstr ""
2017
 
2018
- #: view/view-pricing-rules.php:624
2019
  msgid " Product(s) "
2020
  msgstr ""
2021
 
2022
- #: view/view-pricing-rules.php:628
2023
  msgid "Category(ies)"
2024
  msgstr ""
2025
 
2026
- #: view/view-pricing-rules.php:639
2027
  msgid "Guide for product dependent rules"
2028
  msgstr ""
2029
 
2030
- #: view/view-pricing-rules.php:655
2031
  msgid "Add New Range"
2032
  msgstr ""
2033
 
2034
- #: view/view-pricing-rules.php:660
2035
  msgid ""
2036
  "Package / bundle deals should NOT be mixed with any other adjustment types "
2037
  "when adding ranges. Example: If your first range's adjustment type is "
2038
  "Package / Bundle deal, other ranges should also be same type."
2039
  msgstr ""
2040
 
2041
- #: view/view-pricing-rules.php:861
2042
  msgid ""
2043
  "<b>Example for Bundle (Set) Discount:</b> 3 for $10, 6 for $20<br>So "
2044
  "customer can add 3 products / quantities and get them for $10<br><b>NOTE:</"
@@ -2046,11 +2081,11 @@ msgid ""
2046
  "the 3 for $10 deal)"
2047
  msgstr ""
2048
 
2049
- #: view/view-pricing-rules.php:863 view/view-pricing-rules.php:873
2050
  msgid "Read docs"
2051
  msgstr ""
2052
 
2053
- #: view/view-pricing-rules.php:871
2054
  msgid ""
2055
  "<b>Example for Fixed Price Per Unit:</b> Product A cost is $20. If customers "
2056
  "buy 5 to 10, they can get at $15 each (per unit).<br>Customer adds 6 "
@@ -2058,14 +2093,14 @@ msgid ""
2058
  "b> Enter the Unit price like 15"
2059
  msgstr ""
2060
 
2061
- #: view/view-pricing-rules.php:878
2062
  msgid "Guide to create perfect BOGO rules"
2063
  msgstr ""
2064
 
2065
- #: view/view-pricing-rules.php:888
2066
  msgid "Percent"
2067
  msgstr ""
2068
 
2069
- #: view/view-pricing-rules.php:889
2070
  msgid "Fixed"
2071
  msgstr ""
15
  msgid "Guest"
16
  msgstr ""
17
 
18
+ #: helper/general-helper.php:614
19
  msgid "Start date and time is set in the future date"
20
  msgstr ""
21
 
22
+ #: helper/general-helper.php:617
23
  msgid "Validity expired"
24
  msgstr ""
25
 
26
+ #: helper/general-helper.php:634
27
  msgid "Will run in future"
28
  msgstr ""
29
 
30
+ #: helper/general-helper.php:637
31
  msgid "Not running - validity expired"
32
  msgstr ""
33
 
34
+ #: helper/general-helper.php:654
35
  msgid "Running"
36
  msgstr ""
37
 
38
+ #: helper/general-helper.php:659
39
  msgid "Your server current date and time: "
40
  msgstr ""
41
 
42
+ #: helper/general-helper.php:794
43
  msgid "Read Docs"
44
  msgstr ""
45
 
46
+ #: helper/general-helper.php:1031 view/view-cart-rules.php:697
47
+ #: view/view-pricing-rules.php:401
48
+ msgid "Coupon already exists in WooCommerce. Please select another name"
49
+ msgstr ""
50
+
51
  #: helper/purchase.php:25 view/includes/cart-menu.php:5
52
  #: view/includes/menu.php:6 view/includes/sub-menu.php:5
53
  msgid "Woo Discount Rules"
148
  msgid "Title to be display on site"
149
  msgstr ""
150
 
151
+ #: includes/cart-rules.php:113 includes/pricing-rules.php:120
152
+ msgid "Saved successfully"
153
+ msgstr ""
154
+
155
+ #: includes/cart-rules.php:163 includes/pricing-rules.php:153
156
+ msgid "Failed to save"
157
+ msgstr ""
158
+
159
  #: includes/discount-base.php:195 view/cart-rules.php:147
160
  #: view/pricing-rules.php:177
161
  msgid "Active"
227
  msgid "Please enter a Key"
228
  msgstr ""
229
 
230
+ #: includes/discount-base.php:1009 view/view-pricing-rules.php:698
231
  msgid "Min Quantity"
232
  msgstr ""
233
 
234
+ #: includes/discount-base.php:1010 view/view-pricing-rules.php:705
235
  msgid "Max Quantity"
236
  msgstr ""
237
 
238
+ #: includes/discount-base.php:1011 view/view-pricing-rules.php:613
239
+ #: view/view-pricing-rules.php:616 view/view-pricing-rules.php:636
240
  msgid "Quantity"
241
  msgstr ""
242
 
243
  #: includes/discount-base.php:1012 view/view-cart-rules.php:92
244
+ #: view/view-pricing-rules.php:74 view/view-pricing-rules.php:703
245
+ #: view/view-pricing-rules.php:802 view/view-pricing-rules.php:819
246
+ #: view/view-pricing-rules.php:826
247
  msgid "ex. 1"
248
  msgstr ""
249
 
250
+ #: includes/discount-base.php:1013 view/view-pricing-rules.php:864
251
  msgid "ex. 10"
252
  msgstr ""
253
 
254
+ #: includes/discount-base.php:1014 view/view-pricing-rules.php:710
255
+ #: view/view-pricing-rules.php:770
256
  msgid "ex. 50"
257
  msgstr ""
258
 
260
  msgid "Search for a user"
261
  msgstr ""
262
 
263
+ #: includes/discount-base.php:1016 view/view-pricing-rules.php:711
264
  msgid "Adjustment Type"
265
  msgstr ""
266
 
267
+ #: includes/discount-base.php:1017 view/view-pricing-rules.php:853
268
  msgid "Discount percentage"
269
  msgstr ""
270
 
271
+ #: includes/discount-base.php:1018 view/view-cart-rules.php:738
272
+ #: view/view-pricing-rules.php:717
273
  msgid "Percentage Discount"
274
  msgstr ""
275
 
276
+ #: includes/discount-base.php:1019 view/view-cart-rules.php:744
277
+ #: view/view-cart-rules.php:746 view/view-pricing-rules.php:725
278
+ #: view/view-pricing-rules.php:727
279
  msgid "Price Discount"
280
  msgstr ""
281
 
282
+ #: includes/discount-base.php:1020 view/view-pricing-rules.php:755
283
+ #: view/view-pricing-rules.php:757
284
  msgid "BOGO Product Discount"
285
  msgstr ""
286
 
288
  msgid "Product Discount - Not support for subtotal based rule"
289
  msgstr ""
290
 
291
+ #: includes/discount-base.php:1022 view/view-cart-rules.php:462
292
+ #: view/view-pricing-rules.php:765 view/view-pricing-rules.php:913
293
  msgid "Value"
294
  msgstr ""
295
 
296
+ #: includes/discount-base.php:1023 view/view-pricing-rules.php:787
297
  msgid "receive discount for"
298
  msgstr ""
299
 
300
+ #: includes/discount-base.php:1024 view/view-pricing-rules.php:789
301
  msgid "Auto add all selected products"
302
  msgstr ""
303
 
304
+ #: includes/discount-base.php:1025 view/view-pricing-rules.php:790
305
  msgid "Same product"
306
  msgstr ""
307
 
308
+ #: includes/discount-base.php:1026
309
  msgid "Any one cheapest from selected"
310
  msgstr ""
311
 
312
+ #: includes/discount-base.php:1027
313
  msgid "Any one cheapest from all products"
314
  msgstr ""
315
 
316
+ #: includes/discount-base.php:1028 view/view-pricing-rules.php:791
317
  msgid "Cheapest in cart - selected category(ies)"
318
  msgstr ""
319
 
320
+ #: includes/discount-base.php:1029 view/view-pricing-rules.php:792
321
  msgid "Cheapest in cart - selected item(s)"
322
  msgstr ""
323
 
324
+ #: includes/discount-base.php:1030 view/view-pricing-rules.php:793
325
  msgid "Cheapest among all items in cart"
326
  msgstr ""
327
 
328
+ #: includes/discount-base.php:1031 view/view-pricing-rules.php:797
329
  msgid "Free quantity"
330
  msgstr ""
331
 
332
+ #: includes/discount-base.php:1032 view/view-pricing-rules.php:797
333
  msgid "Number of quantity(ies) in each selected product(s)"
334
  msgstr ""
335
 
336
+ #: includes/discount-base.php:1033 view/view-pricing-rules.php:811
337
  msgid "Fixed item count (not recommended)"
338
  msgstr ""
339
 
340
+ #: includes/discount-base.php:1034 view/view-pricing-rules.php:810
341
  msgid "Dynamic item count"
342
  msgstr ""
343
 
344
+ #: includes/discount-base.php:1035 view/view-pricing-rules.php:813
345
  msgid ""
346
  "Fixed item count - You need to provide item count manually. Dynamic item "
347
  "count - System will choose dynamically based on cart"
348
  msgstr ""
349
 
350
+ #: includes/discount-base.php:1036 view/view-pricing-rules.php:814
351
  msgid "Item count"
352
  msgstr ""
353
 
354
+ #: includes/discount-base.php:1037 view/view-pricing-rules.php:814
355
  msgid "Discount for number of item(s) in cart"
356
  msgstr ""
357
 
358
+ #: includes/discount-base.php:1038 view/view-pricing-rules.php:821
359
+ msgid "Discount for number of quantity(ies)"
360
  msgstr ""
361
 
362
+ #: includes/discount-base.php:1039 view/view-pricing-rules.php:821
363
  msgid "Item quantity"
364
  msgstr ""
365
 
371
  msgid "and"
372
  msgstr ""
373
 
374
+ #: includes/discount-base.php:1042 view/view-pricing-rules.php:855
375
  msgid "100% percent"
376
  msgstr ""
377
 
378
+ #: includes/discount-base.php:1043 view/view-pricing-rules.php:856
379
  msgid "Limited percent"
380
  msgstr ""
381
 
387
  msgid "as discount"
388
  msgstr ""
389
 
390
+ #: includes/discount-base.php:1046 view/view-cart-rules.php:701
391
+ #: view/view-pricing-rules.php:870
392
  msgid "Remove"
393
  msgstr ""
394
 
395
  #: includes/discount-base.php:1047 view/cart-rules.php:170
396
+ #: view/pricing-rules.php:200 view/view-pricing-rules.php:873
397
  msgid "Duplicate"
398
  msgstr ""
399
 
464
  msgid "Including sub-categories in cart"
465
  msgstr ""
466
 
467
+ #: includes/discount-base.php:1065 view/view-cart-rules.php:267
468
  msgid "Customer Details (must be logged in)"
469
  msgstr ""
470
 
471
+ #: includes/discount-base.php:1066 view/view-cart-rules.php:273
472
+ #: view/view-cart-rules.php:275
473
  msgid "User in list"
474
  msgstr ""
475
 
476
+ #: includes/discount-base.php:1067 view/view-cart-rules.php:283
477
+ #: view/view-cart-rules.php:285
478
  msgid "User role in list"
479
  msgstr ""
480
 
481
+ #: includes/discount-base.php:1068 view/view-cart-rules.php:349
482
+ #: view/view-cart-rules.php:351
483
  msgid "Shipping country in list"
484
  msgstr ""
485
 
486
+ #: includes/discount-base.php:1069 view/view-cart-rules.php:289
487
  msgid "Customer Email"
488
  msgstr ""
489
 
491
  msgid "Email with TLD (Ege: edu)"
492
  msgstr ""
493
 
494
+ #: includes/discount-base.php:1071 view/view-cart-rules.php:305
495
+ #: view/view-cart-rules.php:307
496
  msgid "Email with Domain (Eg: gmail.com)"
497
  msgstr ""
498
 
499
+ #: includes/discount-base.php:1072 view/view-cart-rules.php:311
500
  msgid "Customer Billing Details"
501
  msgstr ""
502
 
503
+ #: includes/discount-base.php:1073 view/view-cart-rules.php:317
504
+ #: view/view-cart-rules.php:319
505
  msgid "Billing city"
506
  msgstr ""
507
 
508
+ #: includes/discount-base.php:1074 view/view-cart-rules.php:323
509
  msgid "Customer Shipping Details"
510
  msgstr ""
511
 
512
+ #: includes/discount-base.php:1075 view/view-cart-rules.php:339
513
+ #: view/view-cart-rules.php:341
514
  msgid "Shipping state"
515
  msgstr ""
516
 
517
+ #: includes/discount-base.php:1076 view/view-cart-rules.php:329
518
+ #: view/view-cart-rules.php:331
519
  msgid "Shipping city"
520
  msgstr ""
521
 
522
+ #: includes/discount-base.php:1077 view/view-cart-rules.php:359
523
+ #: view/view-cart-rules.php:361
524
  msgid "Shipping zip code"
525
  msgstr ""
526
 
527
+ #: includes/discount-base.php:1078 view/view-cart-rules.php:365
528
+ #: view/view-pricing-rules.php:500
529
  msgid "Purchase History"
530
  msgstr ""
531
 
532
+ #: includes/discount-base.php:1079 view/view-cart-rules.php:381
533
+ #: view/view-cart-rules.php:383 view/view-pricing-rules.php:509
534
  msgid "Purchased amount"
535
  msgstr ""
536
 
537
+ #: includes/discount-base.php:1080 view/view-cart-rules.php:391
538
+ #: view/view-cart-rules.php:393 view/view-pricing-rules.php:510
539
  msgid "Number of previous orders made"
540
  msgstr ""
541
 
542
+ #: includes/discount-base.php:1081 view/view-cart-rules.php:401
543
+ #: view/view-cart-rules.php:403 view/view-pricing-rules.php:511
544
  msgid "Number of previous orders made with following products"
545
  msgstr ""
546
 
547
+ #: includes/discount-base.php:1082 view/view-cart-rules.php:411
548
+ #: view/view-cart-rules.php:413 view/view-pricing-rules.php:512
549
  msgid "Number of quantity(s) in previous orders made with following products"
550
  msgstr ""
551
 
552
+ #: includes/discount-base.php:1083 view/view-cart-rules.php:417
553
  msgid "Coupon applied"
554
  msgstr ""
555
 
556
+ #: includes/discount-base.php:1084 view/view-cart-rules.php:423
557
+ #: view/view-cart-rules.php:425 view/view-pricing-rules.php:378
558
+ msgid "Create your own coupon"
559
+ msgstr ""
560
+
561
+ #: includes/discount-base.php:1085 view/view-cart-rules.php:433
562
+ #: view/view-cart-rules.php:435
563
+ msgid "Atleast any one (Select from WooCommerce)"
564
  msgstr ""
565
 
566
+ #: includes/discount-base.php:1086 view/view-cart-rules.php:443
567
+ #: view/view-cart-rules.php:445
568
+ msgid "All selected (Select from WooCommerce)"
569
  msgstr ""
570
 
571
+ #: includes/discount-base.php:1087 view/view-cart-rules.php:647
572
+ #: view/view-pricing-rules.php:549
573
  msgid "Greater than or equal to"
574
  msgstr ""
575
 
576
+ #: includes/discount-base.php:1088 view/view-cart-rules.php:648
577
+ #: view/view-pricing-rules.php:550 view/view-pricing-rules.php:609
578
  msgid "Less than or equal to"
579
  msgstr ""
580
 
581
+ #: includes/discount-base.php:1089 view/view-cart-rules.php:650
582
+ #: view/view-pricing-rules.php:553
583
  msgid "and the order status should be"
584
  msgstr ""
585
 
586
+ #: includes/discount-base.php:1090 view/cart-rules.php:114
587
  #: view/cart-rules.php:209 view/pricing-rules.php:144
588
+ #: view/pricing-rules.php:239 view/view-cart-rules.php:700
589
  msgid "Action"
590
  msgstr ""
591
 
592
+ #: includes/discount-base.php:1091 view/settings.php:33
593
  #: view/settings_taxonomy.php:21
594
  msgid "Save"
595
  msgstr ""
596
 
597
+ #: includes/discount-base.php:1092
598
  msgid "Saved Successfully!"
599
  msgstr ""
600
 
601
+ #: includes/discount-base.php:1093 view/view-cart-rules.php:491
602
+ #: view/view-cart-rules.php:559 view/view-cart-rules.php:579
603
+ #: view/view-cart-rules.php:600 view/view-cart-rules.php:655
604
  #: view/view-pricing-rules.php:235 view/view-pricing-rules.php:251
605
+ #: view/view-pricing-rules.php:561 view/view-pricing-rules.php:645
606
+ #: view/view-pricing-rules.php:841
607
  msgid "None selected"
608
  msgstr ""
609
 
610
+ #: includes/discount-base.php:1094 view/view-cart-rules.php:258
611
  msgid "In each category"
612
  msgstr ""
613
 
614
+ #: includes/discount-base.php:1095 view/settings_price_rules.php:208
615
  #: view/settings_price_rules.php:226 view/settings_price_rules.php:244
616
  #: view/settings_price_rules.php:262
617
  msgid "Show"
618
  msgstr ""
619
 
620
+ #: includes/discount-base.php:1096 view/template/sidebar.php:12
621
  msgid "Hide"
622
  msgstr ""
623
 
624
+ #: includes/discount-base.php:1097
625
  msgid "Please select at least one rule"
626
  msgstr ""
627
 
628
+ #: includes/discount-base.php:1098
629
  msgid "Please select an action to apply"
630
  msgstr ""
631
 
632
+ #: includes/discount-base.php:1099
633
  msgid "Are you sure to remove the selected rules"
634
  msgstr ""
635
 
636
+ #: includes/discount-base.php:1100 view/view-pricing-rules.php:830
637
  msgid "Choose product(s)"
638
  msgstr ""
639
 
640
+ #: includes/discount-base.php:1101 view/view-pricing-rules.php:840
641
  msgid "Choose category(ies)"
642
  msgstr ""
643
 
644
+ #: includes/discount-base.php:1102
645
  msgid "Search for a coupon"
646
  msgstr ""
647
 
648
+ #: includes/discount-base.php:1103 view/view-pricing-rules.php:864
649
  #, php-format
650
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
651
  msgstr ""
652
 
653
+ #: includes/discount-base.php:1104
654
  #, php-format
655
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
656
  msgstr ""
657
 
658
+ #: includes/discount-base.php:1105
659
  #, php-format
660
  msgid "Enter the discounted price per unit. Eg: <b>10</b> for %s as unit price"
661
  msgstr ""
662
 
663
+ #: includes/discount-base.php:1106
664
  #, php-format
665
  msgid ""
666
  "Enter the price for selected quantity. Eg: <b>10</b> then %s as total price "
667
  "for selected quantity"
668
  msgstr ""
669
 
670
+ #: includes/discount-base.php:1107 view/view-pricing-rules.php:795
671
  msgid ""
672
  "Auto add all selected products - Automatically added to the cart <br> Same "
673
  "product - get discount in same product <br> Any one cheapest from selected - "
678
  "no.of quantities"
679
  msgstr ""
680
 
681
+ #: includes/discount-base.php:1108 view/view-cart-rules.php:221
682
  msgid "Products"
683
  msgstr ""
684
 
685
+ #: includes/discount-base.php:1109 view/view-cart-rules.php:226
686
  msgid "Products in cart"
687
  msgstr ""
688
 
689
+ #: includes/discount-base.php:1110 view/view-cart-rules.php:232
690
  #: view/view-pricing-rules.php:270
691
  msgid "Exclude products"
692
  msgstr ""
693
 
694
+ #: includes/discount-base.php:1111 view/view-cart-rules.php:238
695
  msgid "Exclude on sale products"
696
  msgstr ""
697
 
698
+ #: includes/discount-base.php:1112 view/view-cart-rules.php:529
699
  msgid "This will exclude the on sale products from discount"
700
  msgstr ""
701
 
702
+ #: includes/discount-base.php:1113 view/view-cart-rules.php:663
703
+ #: view/view-pricing-rules.php:568
704
  msgid "From all previous orders"
705
  msgstr ""
706
 
707
+ #: includes/discount-base.php:1114 view/view-cart-rules.php:664
708
+ #: view/view-pricing-rules.php:569
709
  msgid "Last 7 days"
710
  msgstr ""
711
 
712
+ #: includes/discount-base.php:1115 view/view-cart-rules.php:665
713
+ #: view/view-pricing-rules.php:570
714
  msgid "Last 14 days"
715
  msgstr ""
716
 
717
+ #: includes/discount-base.php:1116 view/view-cart-rules.php:666
718
+ #: view/view-pricing-rules.php:571
719
  msgid "Last 30 days"
720
  msgstr ""
721
 
722
+ #: includes/discount-base.php:1117 view/view-cart-rules.php:667
723
+ #: view/view-pricing-rules.php:572
724
  msgid "Last 60 days"
725
  msgstr ""
726
 
727
+ #: includes/discount-base.php:1118 view/view-cart-rules.php:668
728
+ #: view/view-pricing-rules.php:573
729
  msgid "Last 90 days"
730
  msgstr ""
731
 
732
+ #: includes/discount-base.php:1119 view/view-cart-rules.php:669
733
+ #: view/view-pricing-rules.php:574
734
  msgid "Last 180 days"
735
  msgstr ""
736
 
737
+ #: includes/discount-base.php:1120 view/view-cart-rules.php:670
738
+ #: view/view-pricing-rules.php:575
739
  msgid "Last 1 year"
740
  msgstr ""
741
 
742
+ #: includes/discount-base.php:1121 view/view-cart-rules.php:671
743
+ #: view/view-pricing-rules.php:576
744
  msgid "Custom"
745
  msgstr ""
746
 
747
+ #: includes/discount-base.php:1122 view/view-cart-rules.php:674
748
+ #: view/view-pricing-rules.php:580
749
  msgid "in days"
750
  msgstr ""
751
 
752
+ #: includes/discount-base.php:1123 view/view-pricing-rules.php:735
753
+ #: view/view-pricing-rules.php:737
754
  msgid "Fixed Price Per Unit"
755
  msgstr ""
756
 
757
+ #: includes/discount-base.php:1124 view/view-pricing-rules.php:745
758
+ #: view/view-pricing-rules.php:747
759
  msgid "Bundle (Set) Discount"
760
  msgstr ""
761
 
762
+ #: includes/discount-base.php:1125 view/view-cart-rules.php:371
763
+ #: view/view-cart-rules.php:373 view/view-pricing-rules.php:508
764
+ msgid "First Order discount"
765
+ msgstr ""
766
+
767
+ #: includes/discount-base.php:1126 view/view-cart-rules.php:264
768
+ msgid "Exclude categories in cart"
769
+ msgstr ""
770
+
771
+ #: includes/discount-base.php:1204 view/includes/menu.php:13
772
  msgid "Settings"
773
  msgstr ""
774
 
775
+ #: includes/pricing-rules.php:3104 view/view-pricing-rules.php:601
776
  msgid "Buy"
777
  msgstr ""
778
 
779
+ #: includes/pricing-rules.php:3108
780
  msgid " less than or equal to "
781
  msgstr ""
782
 
783
+ #: includes/pricing-rules.php:3108 includes/pricing-rules.php:3114
784
  msgid " Quantity"
785
  msgstr ""
786
 
787
+ #: includes/pricing-rules.php:3111
788
  msgid " Quantity "
789
  msgstr ""
790
 
791
+ #: includes/pricing-rules.php:3118
792
  msgid " or more Quantity"
793
  msgstr ""
794
 
795
+ #: includes/pricing-rules.php:3127
796
  msgid " any "
797
  msgstr ""
798
 
799
+ #: includes/pricing-rules.php:3127
800
  msgid " products from "
801
  msgstr ""
802
 
803
+ #: includes/pricing-rules.php:3134
804
  msgid " in each products"
805
  msgstr ""
806
 
807
+ #: includes/pricing-rules.php:3146
808
  msgid " and get discount on "
809
  msgstr ""
810
 
811
+ #: includes/pricing-rules.php:3149
812
  msgid " first "
813
  msgstr ""
814
 
815
+ #: includes/pricing-rules.php:3151 includes/pricing-rules.php:3155
816
  msgid " quantity of product(s) - "
817
  msgstr ""
818
 
819
+ #: includes/pricing-rules.php:3153
820
  msgid " after first "
821
  msgstr ""
822
 
823
+ #: includes/pricing-rules.php:3171
824
  msgid "Category(ies) "
825
  msgstr ""
826
 
827
+ #: includes/pricing-rules.php:3242
828
  msgid "Get "
829
  msgstr ""
830
 
831
+ #: includes/pricing-rules.php:3244
832
  #, php-format
833
  msgid "% discount in "
834
  msgstr ""
835
 
836
+ #: includes/pricing-rules.php:3247
837
  msgid "same product"
838
  msgstr ""
839
 
840
+ #: includes/pricing-rules.php:3249
841
  msgid "any cheapest one from cart"
842
  msgstr ""
843
 
844
+ #: includes/pricing-rules.php:3252
845
  msgid "any cheapest one of "
846
  msgstr ""
847
 
848
+ #: includes/pricing-rules.php:3257
849
  msgid " quantity of any "
850
  msgstr ""
851
 
852
+ #: includes/pricing-rules.php:3259
853
  msgid " cheapest item "
854
  msgstr ""
855
 
856
+ #: includes/pricing-rules.php:3262
857
  msgid " quantity of cheapest item "
858
  msgstr ""
859
 
860
+ #: includes/pricing-rules.php:3266
861
  msgid "from the category "
862
  msgstr ""
863
 
864
+ #: includes/pricing-rules.php:3288
865
  #, php-format
866
  msgid "%s for %s Quantity(s)"
867
  msgstr ""
868
 
869
+ #: includes/pricing-rules.php:3290
870
  #, php-format
871
  msgid "%s as price per unit"
872
  msgstr ""
985
  msgstr ""
986
 
987
  #: view/cart-rules.php:98 view/cart-rules.php:193 view/pricing-rules.php:128
988
+ #: view/pricing-rules.php:223 view/template/discount-table.php:36
989
  msgid "Name"
990
  msgstr ""
991
 
1146
  msgstr ""
1147
 
1148
  #: view/includes/cart-menu.php:9 view/includes/sub-menu.php:9
1149
+ #: view/settings.php:38 view/view-cart-rules.php:65
1150
  #: view/view-pricing-rules.php:47
1151
  msgid "General"
1152
  msgstr ""
1156
  msgstr ""
1157
 
1158
  #: view/includes/cart-menu.php:13 view/includes/sub-menu.php:13
1159
+ #: view/template/discount-table.php:42 view/view-cart-rules.php:718
1160
+ #: view/view-pricing-rules.php:667
1161
  msgid "Discount"
1162
  msgstr ""
1163
 
1202
  msgid "Price Rules"
1203
  msgstr ""
1204
 
1205
+ #: view/settings.php:39
1206
  msgid "Price rules"
1207
  msgstr ""
1208
 
1209
+ #: view/settings.php:40
1210
  msgid "Cart rules"
1211
  msgstr ""
1212
 
1213
+ #: view/settings.php:41
1214
  msgid "Performance"
1215
  msgstr ""
1216
 
1217
+ #: view/settings.php:42
1218
  msgid "Promotion"
1219
  msgstr ""
1220
 
1272
 
1273
  #: view/settings_cart_rules.php:92 view/settings_price_rules.php:313
1274
  #: view/view-pricing-rules.php:300 view/view-pricing-rules.php:357
1275
+ #: view/view-pricing-rules.php:441 view/view-pricing-rules.php:489
1276
+ #: view/view-pricing-rules.php:520
1277
  msgid "Supported in PRO version"
1278
  msgstr ""
1279
 
1617
  "More examples can be found in the documentation"
1618
  msgstr ""
1619
 
1620
+ #: view/template/discount-table.php:23
1621
+ msgid "Hide table"
1622
+ msgstr ""
1623
+
1624
+ #: view/template/discount-table.php:25
1625
+ msgid "This effect displays only for you (Admin)"
1626
+ msgstr ""
1627
+
1628
+ #: view/template/discount-table.php:39
1629
  msgid "Range"
1630
  msgstr ""
1631
 
1632
+ #: view/template/discount-table.php:74
1633
  msgid "No Active Discounts."
1634
  msgstr ""
1635
 
1751
  msgstr ""
1752
 
1753
  #: view/view-cart-rules.php:135 view/view-pricing-rules.php:144
1754
+ #: view/view-pricing-rules.php:611
1755
  msgid "From"
1756
  msgstr ""
1757
 
1764
  msgid "Current date and time: %s"
1765
  msgstr ""
1766
 
1767
+ #: view/view-cart-rules.php:145 view/view-cart-rules.php:712
1768
+ #: view/view-pricing-rules.php:183 view/view-pricing-rules.php:660
1769
  msgid "Next"
1770
  msgstr ""
1771
 
1781
  msgid "Categories In Cart"
1782
  msgstr ""
1783
 
1784
+ #: view/view-cart-rules.php:295 view/view-cart-rules.php:297
1785
  msgid "Email with TLD (Eg: edu)"
1786
  msgstr ""
1787
 
1788
+ #: view/view-cart-rules.php:711 view/view-cart-rules.php:808
1789
+ #: view/view-pricing-rules.php:659 view/view-pricing-rules.php:918
1790
  msgid "Previous"
1791
  msgstr ""
1792
 
1793
+ #: view/view-cart-rules.php:714
1794
  msgid "Guide to create cart rules"
1795
  msgstr ""
1796
 
1797
+ #: view/view-cart-rules.php:734
1798
  msgid "Discount Type :"
1799
  msgstr ""
1800
 
1801
+ #: view/view-cart-rules.php:753 view/view-cart-rules.php:755
1802
  msgid "Product Discount"
1803
  msgstr ""
1804
 
1805
+ #: view/view-cart-rules.php:762 view/view-cart-rules.php:764
1806
  msgid "Free shipping"
1807
  msgstr ""
1808
 
1809
+ #: view/view-cart-rules.php:773
1810
  msgid "value :"
1811
  msgstr ""
1812
 
1813
+ #: view/view-cart-rules.php:781
1814
  msgid "Select products :"
1815
  msgstr ""
1816
 
1817
+ #: view/view-cart-rules.php:795
1818
  msgid "Quantity :"
1819
  msgstr ""
1820
 
1949
  msgid "Customers"
1950
  msgstr ""
1951
 
1952
+ #: view/view-pricing-rules.php:318 view/view-pricing-rules.php:632
1953
  msgid "All"
1954
  msgstr ""
1955
 
1961
  msgid "User roles"
1962
  msgstr ""
1963
 
1964
+ #: view/view-pricing-rules.php:346 view/view-pricing-rules.php:377
1965
+ #: view/view-pricing-rules.php:464 view/view-pricing-rules.php:507
1966
  msgid "Do not use"
1967
  msgstr ""
1968
 
1970
  msgid "Coupon"
1971
  msgstr ""
1972
 
1973
+ #: view/view-pricing-rules.php:379
1974
+ msgid "Apply if any one coupon applied (Select from WooCommerce)"
1975
  msgstr ""
1976
 
1977
+ #: view/view-pricing-rules.php:380
1978
+ msgid "Apply if all coupon applied (Select from WooCommerce)"
1979
  msgstr ""
1980
 
1981
+ #: view/view-pricing-rules.php:431
1982
  msgid "Make sure you have created the coupon already"
1983
  msgstr ""
1984
 
1985
+ #: view/view-pricing-rules.php:452
1986
  msgid "Subtotal"
1987
  msgstr ""
1988
 
1989
+ #: view/view-pricing-rules.php:453
1990
  msgid "Applies for the whole cart subtotal (not recommended)."
1991
  msgstr ""
1992
 
1993
+ #: view/view-pricing-rules.php:465
1994
  msgid "Subtotal atleast"
1995
  msgstr ""
1996
 
1997
+ #: view/view-pricing-rules.php:470
1998
  msgid "Enter the amount"
1999
  msgstr ""
2000
 
2001
+ #: view/view-pricing-rules.php:480
2002
  msgid "Supported in WooCommerce 3.x"
2003
  msgstr ""
2004
 
2005
+ #: view/view-pricing-rules.php:603
2006
  msgid "Any"
2007
  msgstr ""
2008
 
2009
+ #: view/view-pricing-rules.php:604
2010
  msgid "Each"
2011
  msgstr ""
2012
 
2013
+ #: view/view-pricing-rules.php:605
2014
  msgid "Combine"
2015
  msgstr ""
2016
 
2017
+ #: view/view-pricing-rules.php:608
2018
  msgid "More than or equal to"
2019
  msgstr ""
2020
 
2021
+ #: view/view-pricing-rules.php:610
2022
  msgid "Equal"
2023
  msgstr ""
2024
 
2025
+ #: view/view-pricing-rules.php:615
2026
  msgid "to"
2027
  msgstr ""
2028
 
2029
+ #: view/view-pricing-rules.php:619
2030
  msgid "Product(s) from"
2031
  msgstr ""
2032
 
2033
+ #: view/view-pricing-rules.php:625
2034
  msgid "Apply discount in product(s)"
2035
  msgstr ""
2036
 
2037
+ #: view/view-pricing-rules.php:626
2038
  msgid "Apply discount in category(ies)"
2039
  msgstr ""
2040
 
2041
+ #: view/view-pricing-rules.php:630
2042
  msgid "and get discount on "
2043
  msgstr ""
2044
 
2045
+ #: view/view-pricing-rules.php:633
2046
  msgid "First quantity(s)"
2047
  msgstr ""
2048
 
2049
+ #: view/view-pricing-rules.php:634
2050
  msgid "Skip first quantity(s)"
2051
  msgstr ""
2052
 
2053
+ #: view/view-pricing-rules.php:639
2054
  msgid " Product(s) "
2055
  msgstr ""
2056
 
2057
+ #: view/view-pricing-rules.php:643
2058
  msgid "Category(ies)"
2059
  msgstr ""
2060
 
2061
+ #: view/view-pricing-rules.php:654
2062
  msgid "Guide for product dependent rules"
2063
  msgstr ""
2064
 
2065
+ #: view/view-pricing-rules.php:670
2066
  msgid "Add New Range"
2067
  msgstr ""
2068
 
2069
+ #: view/view-pricing-rules.php:675
2070
  msgid ""
2071
  "Package / bundle deals should NOT be mixed with any other adjustment types "
2072
  "when adding ranges. Example: If your first range's adjustment type is "
2073
  "Package / Bundle deal, other ranges should also be same type."
2074
  msgstr ""
2075
 
2076
+ #: view/view-pricing-rules.php:884
2077
  msgid ""
2078
  "<b>Example for Bundle (Set) Discount:</b> 3 for $10, 6 for $20<br>So "
2079
  "customer can add 3 products / quantities and get them for $10<br><b>NOTE:</"
2081
  "the 3 for $10 deal)"
2082
  msgstr ""
2083
 
2084
+ #: view/view-pricing-rules.php:886 view/view-pricing-rules.php:896
2085
  msgid "Read docs"
2086
  msgstr ""
2087
 
2088
+ #: view/view-pricing-rules.php:894
2089
  msgid ""
2090
  "<b>Example for Fixed Price Per Unit:</b> Product A cost is $20. If customers "
2091
  "buy 5 to 10, they can get at $15 each (per unit).<br>Customer adds 6 "
2093
  "b> Enter the Unit price like 15"
2094
  msgstr ""
2095
 
2096
+ #: view/view-pricing-rules.php:901
2097
  msgid "Guide to create perfect BOGO rules"
2098
  msgstr ""
2099
 
2100
+ #: view/view-pricing-rules.php:911
2101
  msgid "Percent"
2102
  msgstr ""
2103
 
2104
+ #: view/view-pricing-rules.php:912
2105
  msgid "Fixed"
2106
  msgstr ""
includes/cart-rules.php CHANGED
@@ -109,6 +109,8 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
109
  */
110
  public function save($request)
111
  {
 
 
112
  foreach ($request as $index => $value) {
113
  if ($index !== 'discount_rule') {
114
  $request[$index] = FlycartWooDiscountRulesGeneralHelper::makeString($value);
@@ -141,11 +143,40 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
141
  'product_discount_quantity',
142
  'to_discount',
143
  'discount_rule',
 
144
  'rule_order',
145
  'status',
146
  'wpml_language',
147
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
 
 
 
149
  if ($id) {
150
  $post = array(
151
  'ID' => $id,
@@ -168,18 +199,6 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
168
  $request['status'] = 'publish';
169
  }
170
  $request['rule_order'] = FlycartWooDiscountRulesGeneralHelper::reOrderRuleIfExists($id, $request['rule_order'], $this->post_type);
171
- $coupons_used = array();
172
- $coupon_keys = array('coupon_applied_any_one','coupon_applied_all_selected');
173
- foreach ($request['discount_rule'] as $index => $value) {
174
- foreach ($coupon_keys as $coupon_key){
175
- if(isset($value[$coupon_key]) && !empty($value[$coupon_key])){
176
- if(is_array($value[$coupon_key])){
177
- $coupons_used = array_merge($coupons_used, $value[$coupon_key]);
178
- }
179
- }
180
- }
181
- $request['discount_rule'][$index] = FlycartWooDiscountRulesGeneralHelper::makeString($value);
182
- }
183
 
184
  $product_keys = array('products_in_list','products_not_in_list');
185
  foreach ($request['discount_rule'] as $index => $value) {
@@ -207,6 +226,8 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
207
  }
208
  }
209
  }
 
 
210
  }
211
 
212
  /**
@@ -334,18 +355,18 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
334
  /**
335
  * Virtually add Coupon to apply the Discount.
336
  *
337
- * @param array $unknown_param
338
- * @param string $old_coupon_code Existing Coupon
339
- * @return array|bool
340
  */
341
- public function addVirtualCoupon($response, $old_coupon_code)
342
  {
343
  $coupon_code = $this->coupon_code;
344
  // Getting Coupon Remove status from Session.
345
  $is_removed = WC()->session->get('woo_coupon_removed');
346
  // If Both are same, then it won't added.
347
- if ($coupon_code == $is_removed) return false;
348
- if ($old_coupon_code == $coupon_code || wc_strtolower($old_coupon_code) == wc_strtolower($coupon_code)) {
349
 
350
  if ($this->postData->get('remove_coupon', false) == $coupon_code) return false;
351
  $this->makeLog();
@@ -734,6 +755,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
734
  if ($rule['enabled'] == true) {
735
  $discounts['name'][$index] = $rule['name'];
736
  $discounts['type'][$index] = $rule['discount_type'];
 
 
 
737
  if ($rule['discount_type'] == 'shipping_price') {
738
  $this->has_free_shipping = 1;
739
  } else if ($rule['discount_type'] == 'price_discount') {
@@ -745,9 +769,6 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
745
  $this->calculateProductDiscount($rule['cart_discounted_products'],$rule['product_discount_quantity']);
746
  }
747
  } else {
748
- //we will have to re-calculate the sub-total if it has category selected
749
- $this->has_category_in_rule = $this->is_category_specific($rule);
750
- $this->has_product_specific_rule = $this->is_product_specific($rule);
751
  if($this->has_category_in_rule || $this->has_product_specific_rule) {
752
  if(!empty($this->cart_items)){
753
  if(!did_action('woocommerce_before_calculate_totals')){
@@ -759,6 +780,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
759
  } else {
760
  $subtotal = $this->sub_total;
761
  }
 
762
  // Getting the Percentage level of Discount.
763
  $discounts['to_discount'][$index] = $this->calculateDiscount($subtotal, array('type' => 'percentage', 'value' => $rule['to_discount']));
764
  }
@@ -777,6 +799,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
777
  if ($rule['enabled'] == true) {
778
  $discounts['name'][$index] = $rule['name'];
779
  $discounts['type'][$index] = $rule['discount_type'];
 
 
 
780
  if ($rule['discount_type'] == 'shipping_price') {
781
  $this->has_free_shipping = 1;
782
  } else if ($rule['discount_type'] == 'price_discount') {
@@ -788,15 +813,13 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
788
  $this->calculateProductDiscount($rule['cart_discounted_products'],$rule['product_discount_quantity']);
789
  }
790
  } else {
791
- //we will have to re-calculate the sub-total if it has category selected
792
- $this->has_category_in_rule = $this->is_category_specific($rule);
793
- $this->has_product_specific_rule = $this->is_product_specific($rule);
794
  if($this->has_category_in_rule || $this->has_product_specific_rule) {
795
  //re-calculate the sub-total
796
  $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule), $rule);
797
  }else {
798
  $subtotal = $this->sub_total;
799
  }
 
800
  // Getting the Percentage level of Discount.
801
  $discounts['to_discount'][$index] = $this->calculateDiscount($subtotal, array('type' => 'percentage', 'value' => $rule['to_discount']));
802
  }
@@ -815,6 +838,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
815
  // Processing the Totals.
816
  foreach ($this->rule_sets as $index => $rule) {
817
  if ($rule['enabled'] == true) {
 
 
 
818
  if ($rule['discount_type'] == 'shipping_price') {
819
  $this->has_free_shipping = 1;
820
  $newDiscount = 0;
@@ -827,19 +853,16 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
827
  $this->calculateProductDiscount($rule['cart_discounted_products'],$rule['product_discount_quantity']);
828
  }
829
  } else {
830
- //we will have to re-calculate the sub-total if it has category selected
831
- $this->has_category_in_rule = $this->is_category_specific($rule);
832
- $this->has_product_specific_rule = $this->is_product_specific($rule);
833
  if($this->has_category_in_rule || $this->has_product_specific_rule) {
834
  //re-calculate the sub-total
835
  $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule), $rule);
836
  }else {
837
  $subtotal = $this->sub_total;
838
  }
 
839
  // Getting the Percentage level of Discount.
840
  $newDiscount = $this->calculateDiscount($subtotal, array('type' => 'percentage', 'value' => $rule['to_discount']));
841
  }
842
-
843
  if($newDiscount > $biggestDiscount){
844
  $biggestDiscount = $newDiscount;
845
  $discounts['name'][1] = $rule['name'];
@@ -916,6 +939,10 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
916
 
917
  if(count($rules)) {
918
  foreach($rules as $rule) {
 
 
 
 
919
  if(array_key_exists('categories_in', $rule)) {
920
  $categories = $rule['categories_in'];
921
  break;
@@ -969,7 +996,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
969
  */
970
  public function applyRule($index, $rule, $rules, $rules_with_all_data)
971
  {
972
- $skipRuleType = array('categories_in', 'in_each_category', 'atleast_one_including_sub_categories', 'products_in_list', 'products_not_in_list', 'exclude_sale_products');
973
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
974
  switch ($index) {
975
 
@@ -1290,6 +1317,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1290
  case 'products_not_in_list':
1291
  case 'exclude_sale_products':
1292
  case 'categories_in':
 
1293
  case 'atleast_one_including_sub_categories':
1294
  case 'in_each_category':
1295
  if(count($rule)){
@@ -1300,6 +1328,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1300
  }
1301
  return false;
1302
  break;
 
1303
  case 'customer_based_on_purchase_history':
1304
  case 'customer_based_on_purchase_history_order_count':
1305
  case 'customer_based_on_purchase_history_product_order_count':
@@ -1312,8 +1341,15 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1312
  }
1313
  return false;
1314
  break;
 
1315
  case 'coupon_applied_any_one':
1316
  if(!empty($rule)){
 
 
 
 
 
 
1317
  $ruleSuccess = $this->validateCartCouponAppliedAnyOne($index, $rule, $rules);
1318
  if($ruleSuccess){
1319
  if(is_string($rule)){
@@ -1323,8 +1359,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1323
  } else {
1324
  return false;
1325
  }
1326
-
1327
- FlycartWooDiscountRulesGeneralHelper::removeCouponPriceInCart($coupons);
 
1328
  return true;
1329
  }
1330
  }
@@ -1424,6 +1461,11 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1424
  $user = get_current_user_id();
1425
  $email = FlycartWooDiscountRulesGeneralHelper::get_billing_email_from_post();
1426
  if($user || !empty($email)){
 
 
 
 
 
1427
  $purchase_history_status_list = isset($rule['purchase_history_order_status'])? $rule['purchase_history_order_status']: array('wc-completed');
1428
  if(isset($rule['purchased_history_amount'])){
1429
  if($rule['purchased_history_amount'] >= 0){
@@ -1435,10 +1477,15 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1435
  'post_type' => wc_get_order_types(),
1436
  'post_status' => $purchase_history_status_list,
1437
  );
1438
- if(!empty($email)){
1439
- $query['meta_key'] = '_billing_email';
1440
- } else {
 
 
 
1441
  $query['meta_key'] = '_customer_user';
 
 
1442
  }
1443
 
1444
  if($purchased_history_duration != 'all_time'){
@@ -1471,6 +1518,13 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1471
  $totalPurchasedAmount = $totalOrder = $totalQuantityPurchased = 0;
1472
  if(!empty($customerOrders)){
1473
  foreach ($customerOrders as $customerOrder) {
 
 
 
 
 
 
 
1474
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1475
  $total = FlycartWoocommerceOrder::get_total($order);
1476
  if(($index == 'customer_based_on_purchase_history_product_order_count' || $index == 'customer_based_on_purchase_history_product_quantity_count') && isset($rule['purchase_history_products'])){
@@ -1725,7 +1779,14 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1725
  $allow_discount = false;
1726
  }
1727
  }
1728
-
 
 
 
 
 
 
 
1729
  if($allow_discount){
1730
  if(isset($rules['atleast_one_including_sub_categories'])){
1731
  if(!empty($rules['atleast_one_including_sub_categories']) && is_array($rules['atleast_one_including_sub_categories'])){
@@ -1789,13 +1850,13 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1789
  $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cartItem['data'], $rules, $rules_with_all_data);
1790
  if($matches){
1791
  $allow_discount = 1;
1792
- $sub_total += $cartItem['line_subtotal'];//+$cartItem['line_subtotal_tax'];
1793
- $quantity += $cartItem['quantity'];
 
1794
  $item_count++;
1795
  }
1796
  }
1797
  }
1798
-
1799
  if($allow_discount){
1800
  $ruleSuccess = 1;
1801
  if(is_array($rules) && count($rules)){
@@ -1833,7 +1894,6 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1833
  }
1834
  }
1835
  $this->categories_and_product_match_value = $ruleSuccess;
1836
-
1837
  return $ruleSuccess;
1838
  }
1839
 
@@ -1893,30 +1953,22 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1893
 
1894
  public function calculate_conditional_subtotal($conditions, $rule) {
1895
  $cart_subtotal = 0;
 
 
 
 
 
 
 
1896
  // Iterate over all cart items and
1897
  if(is_array($this->cart_items) && count($this->cart_items)){
1898
  foreach ($this->cart_items as $cart_item_key => $cart_item) {
1899
  $apply_discount = false;
1900
- if($this->has_category_in_rule){
1901
- if($this->does_item_belong_to_category($conditions, $cart_item['data'])) {
1902
- $apply_discount = true;
1903
- }
1904
- }
1905
 
1906
- if($this->has_product_specific_rule){
1907
- $discount_condition = json_decode($rule['discount_rule'], true);
1908
-
1909
- if(!empty($discount_condition) && is_array($discount_condition)){
1910
- $rules = $discount_condition;
1911
- FlycartWooDiscountRulesGeneralHelper::reArrangeArray($rules);
1912
- $apply_discount_result = $this->checkForProductConditionsMatchesForAnProduct($cart_item['data'], $rules, $discount_condition);
1913
- if($this->has_category_in_rule){
1914
- if($apply_discount){
1915
- $apply_discount = $apply_discount_result;
1916
- }
1917
- } else {
1918
- $apply_discount = $apply_discount_result;
1919
- }
1920
  }
1921
  }
1922
 
@@ -2121,7 +2173,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2121
  $cart_subtotal_except_free = array_sum(array_column($cart,'subtotal')) - $free_item_price;
2122
  $cart_line_item_except_free = (count($cart)-$free_line_item);
2123
 
2124
- $skipRuleType = array('categories_in', 'in_each_category', 'atleast_one_including_sub_categories', 'products_in_list', 'products_not_in_list', 'exclude_sale_products');
2125
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
2126
  switch ($index) {
2127
  // Cart Subtotal.
@@ -2441,6 +2493,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2441
  case 'products_not_in_list':
2442
  case 'exclude_sale_products':
2443
  case 'categories_in':
 
2444
  case 'atleast_one_including_sub_categories':
2445
  case 'in_each_category':
2446
  if(count($rule)){
@@ -2451,6 +2504,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2451
  }
2452
  return false;
2453
  break;
 
2454
  case 'customer_based_on_purchase_history':
2455
  case 'customer_based_on_purchase_history_order_count':
2456
  case 'customer_based_on_purchase_history_product_order_count':
@@ -2463,6 +2517,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2463
  }
2464
  return false;
2465
  break;
 
2466
  case 'coupon_applied_any_one':
2467
  if(!empty($rule)){
2468
  $ruleSuccess = $this->validateCartCouponAppliedAnyOne($index, $rule, $rules);
109
  */
110
  public function save($request)
111
  {
112
+ $result['status'] = 1;
113
+ $result['message'] = esc_html__('Saved successfully', 'woo-discount-rules');
114
  foreach ($request as $index => $value) {
115
  if ($index !== 'discount_rule') {
116
  $request[$index] = FlycartWooDiscountRulesGeneralHelper::makeString($value);
143
  'product_discount_quantity',
144
  'to_discount',
145
  'discount_rule',
146
+ 'dynamic_coupons_to_apply',
147
  'rule_order',
148
  'status',
149
  'wpml_language',
150
  );
151
+ $coupons_used = array();
152
+ $request['dynamic_coupons_to_apply'] = '';
153
+ $coupon_keys = array('coupon_applied_any_one','coupon_applied_all_selected', 'create_dynamic_coupon');
154
+ foreach ($request['discount_rule'] as $index => $value) {
155
+ foreach ($coupon_keys as $coupon_key){
156
+ if($coupon_key === 'create_dynamic_coupon' && !empty($value['create_dynamic_coupon'])){
157
+ $validate_dynamic_coupon = FlycartWooDiscountRulesGeneralHelper::validateDynamicCoupon($value[$coupon_key]);
158
+ $request['dynamic_coupons_to_apply'] = $result['create_dynamic_coupon'] = $validate_dynamic_coupon['coupon'];
159
+ if($validate_dynamic_coupon['status'] === true){
160
+ $request['discount_rule'][$index][$coupon_key] = $value[$coupon_key] = $validate_dynamic_coupon['coupon'];
161
+ } else {
162
+ $result['status'] = 0;
163
+ $result['message'] = esc_html__('Failed to save', 'woo-discount-rules');
164
+ $result['error_message'] = $validate_dynamic_coupon['message'];
165
+ $result['invalid_field'] = 'create_dynamic_coupon';
166
+ echo json_encode($result);
167
+ die();
168
+ }
169
+ } else {
170
+ if(isset($value[$coupon_key]) && !empty($value[$coupon_key])){
171
+ if(is_array($value[$coupon_key])){
172
+ $coupons_used = array_merge($coupons_used, $value[$coupon_key]);
173
+ }
174
+ }
175
+ }
176
 
177
+ }
178
+ $request['discount_rule'][$index] = FlycartWooDiscountRulesGeneralHelper::makeString($value);
179
+ }
180
  if ($id) {
181
  $post = array(
182
  'ID' => $id,
199
  $request['status'] = 'publish';
200
  }
201
  $request['rule_order'] = FlycartWooDiscountRulesGeneralHelper::reOrderRuleIfExists($id, $request['rule_order'], $this->post_type);
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
  $product_keys = array('products_in_list','products_not_in_list');
204
  foreach ($request['discount_rule'] as $index => $value) {
226
  }
227
  }
228
  }
229
+
230
+ echo json_encode($result);
231
  }
232
 
233
  /**
355
  /**
356
  * Virtually add Coupon to apply the Discount.
357
  *
358
+ * @param array $response
359
+ * @param string $coupon_data Existing Coupon
360
+ * @return mixed
361
  */
362
+ public function addVirtualCoupon($response, $coupon_data)
363
  {
364
  $coupon_code = $this->coupon_code;
365
  // Getting Coupon Remove status from Session.
366
  $is_removed = WC()->session->get('woo_coupon_removed');
367
  // If Both are same, then it won't added.
368
+ if ($coupon_code == $is_removed) return $response;
369
+ if ($coupon_data == $coupon_code || wc_strtolower($coupon_data) == wc_strtolower($coupon_code)) {
370
 
371
  if ($this->postData->get('remove_coupon', false) == $coupon_code) return false;
372
  $this->makeLog();
755
  if ($rule['enabled'] == true) {
756
  $discounts['name'][$index] = $rule['name'];
757
  $discounts['type'][$index] = $rule['discount_type'];
758
+ //we will have to re-calculate the sub-total if it has category selected
759
+ $this->has_category_in_rule = $this->is_category_specific($rule);
760
+ $this->has_product_specific_rule = $this->is_product_specific($rule);
761
  if ($rule['discount_type'] == 'shipping_price') {
762
  $this->has_free_shipping = 1;
763
  } else if ($rule['discount_type'] == 'price_discount') {
769
  $this->calculateProductDiscount($rule['cart_discounted_products'],$rule['product_discount_quantity']);
770
  }
771
  } else {
 
 
 
772
  if($this->has_category_in_rule || $this->has_product_specific_rule) {
773
  if(!empty($this->cart_items)){
774
  if(!did_action('woocommerce_before_calculate_totals')){
780
  } else {
781
  $subtotal = $this->sub_total;
782
  }
783
+ $subtotal = apply_filters('woo_discount_rules_before_calculate_discount_from_subtotal_in_cart', $subtotal, $rule['discount_type'], $rule);
784
  // Getting the Percentage level of Discount.
785
  $discounts['to_discount'][$index] = $this->calculateDiscount($subtotal, array('type' => 'percentage', 'value' => $rule['to_discount']));
786
  }
799
  if ($rule['enabled'] == true) {
800
  $discounts['name'][$index] = $rule['name'];
801
  $discounts['type'][$index] = $rule['discount_type'];
802
+ //we will have to re-calculate the sub-total if it has category selected
803
+ $this->has_category_in_rule = $this->is_category_specific($rule);
804
+ $this->has_product_specific_rule = $this->is_product_specific($rule);
805
  if ($rule['discount_type'] == 'shipping_price') {
806
  $this->has_free_shipping = 1;
807
  } else if ($rule['discount_type'] == 'price_discount') {
813
  $this->calculateProductDiscount($rule['cart_discounted_products'],$rule['product_discount_quantity']);
814
  }
815
  } else {
 
 
 
816
  if($this->has_category_in_rule || $this->has_product_specific_rule) {
817
  //re-calculate the sub-total
818
  $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule), $rule);
819
  }else {
820
  $subtotal = $this->sub_total;
821
  }
822
+ $subtotal = apply_filters('woo_discount_rules_before_calculate_discount_from_subtotal_in_cart', $subtotal, $rule['discount_type'], $rule);
823
  // Getting the Percentage level of Discount.
824
  $discounts['to_discount'][$index] = $this->calculateDiscount($subtotal, array('type' => 'percentage', 'value' => $rule['to_discount']));
825
  }
838
  // Processing the Totals.
839
  foreach ($this->rule_sets as $index => $rule) {
840
  if ($rule['enabled'] == true) {
841
+ //we will have to re-calculate the sub-total if it has category selected
842
+ $this->has_category_in_rule = $this->is_category_specific($rule);
843
+ $this->has_product_specific_rule = $this->is_product_specific($rule);
844
  if ($rule['discount_type'] == 'shipping_price') {
845
  $this->has_free_shipping = 1;
846
  $newDiscount = 0;
853
  $this->calculateProductDiscount($rule['cart_discounted_products'],$rule['product_discount_quantity']);
854
  }
855
  } else {
 
 
 
856
  if($this->has_category_in_rule || $this->has_product_specific_rule) {
857
  //re-calculate the sub-total
858
  $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule), $rule);
859
  }else {
860
  $subtotal = $this->sub_total;
861
  }
862
+ $subtotal = apply_filters('woo_discount_rules_before_calculate_discount_from_subtotal_in_cart', $subtotal, $rule['discount_type'], $rule);
863
  // Getting the Percentage level of Discount.
864
  $newDiscount = $this->calculateDiscount($subtotal, array('type' => 'percentage', 'value' => $rule['to_discount']));
865
  }
 
866
  if($newDiscount > $biggestDiscount){
867
  $biggestDiscount = $newDiscount;
868
  $discounts['name'][1] = $rule['name'];
939
 
940
  if(count($rules)) {
941
  foreach($rules as $rule) {
942
+ if(array_key_exists('exclude_categories', $rule)) {
943
+ $categories = $rule['exclude_categories'];
944
+ break;
945
+ }
946
  if(array_key_exists('categories_in', $rule)) {
947
  $categories = $rule['categories_in'];
948
  break;
996
  */
997
  public function applyRule($index, $rule, $rules, $rules_with_all_data)
998
  {
999
+ $skipRuleType = array('categories_in', 'exclude_categories', 'in_each_category', 'atleast_one_including_sub_categories', 'products_in_list', 'products_not_in_list', 'exclude_sale_products');
1000
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
1001
  switch ($index) {
1002
 
1317
  case 'products_not_in_list':
1318
  case 'exclude_sale_products':
1319
  case 'categories_in':
1320
+ case 'exclude_categories':
1321
  case 'atleast_one_including_sub_categories':
1322
  case 'in_each_category':
1323
  if(count($rule)){
1328
  }
1329
  return false;
1330
  break;
1331
+ case 'customer_based_on_first_order':
1332
  case 'customer_based_on_purchase_history':
1333
  case 'customer_based_on_purchase_history_order_count':
1334
  case 'customer_based_on_purchase_history_product_order_count':
1341
  }
1342
  return false;
1343
  break;
1344
+ case 'create_dynamic_coupon':
1345
  case 'coupon_applied_any_one':
1346
  if(!empty($rule)){
1347
+ if($index == 'create_dynamic_coupon'){
1348
+ $apply_discount_in_same_coupon = apply_filters('woo_discount_rules_apply_discount_in_same_coupon_code_which_created', true, $rule, $rules);
1349
+ if($apply_discount_in_same_coupon){
1350
+ $this->coupon_code = $rule;
1351
+ }
1352
+ }
1353
  $ruleSuccess = $this->validateCartCouponAppliedAnyOne($index, $rule, $rules);
1354
  if($ruleSuccess){
1355
  if(is_string($rule)){
1359
  } else {
1360
  return false;
1361
  }
1362
+ if($index == 'coupon_applied_any_one') {
1363
+ FlycartWooDiscountRulesGeneralHelper::removeCouponPriceInCart($coupons);
1364
+ }
1365
  return true;
1366
  }
1367
  }
1461
  $user = get_current_user_id();
1462
  $email = FlycartWooDiscountRulesGeneralHelper::get_billing_email_from_post();
1463
  if($user || !empty($email)){
1464
+ if($index == 'customer_based_on_first_order'){
1465
+ $rule['purchased_history_amount'] = 0;
1466
+ $rule['purchased_history_type'] = 'less_than_or_equal';
1467
+ $rule['purchased_history_duration'] = 'all_time';
1468
+ }
1469
  $purchase_history_status_list = isset($rule['purchase_history_order_status'])? $rule['purchase_history_order_status']: array('wc-completed');
1470
  if(isset($rule['purchased_history_amount'])){
1471
  if($rule['purchased_history_amount'] >= 0){
1477
  'post_type' => wc_get_order_types(),
1478
  'post_status' => $purchase_history_status_list,
1479
  );
1480
+ if($index == 'customer_based_on_first_order'){
1481
+ $query['post_status'] = 'any';
1482
+ $allowed = 1;
1483
+ }
1484
+ if($user){
1485
+ $query['meta_value'] = $user;
1486
  $query['meta_key'] = '_customer_user';
1487
+ } else {
1488
+ $query['meta_key'] = '_billing_email';
1489
  }
1490
 
1491
  if($purchased_history_duration != 'all_time'){
1518
  $totalPurchasedAmount = $totalOrder = $totalQuantityPurchased = 0;
1519
  if(!empty($customerOrders)){
1520
  foreach ($customerOrders as $customerOrder) {
1521
+ if($index == 'customer_based_on_first_order'){
1522
+ if(!in_array($customerOrder->post_status, array('wc-failed'))){
1523
+ return 0;
1524
+ } else{
1525
+ continue;
1526
+ }
1527
+ }
1528
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1529
  $total = FlycartWoocommerceOrder::get_total($order);
1530
  if(($index == 'customer_based_on_purchase_history_product_order_count' || $index == 'customer_based_on_purchase_history_product_quantity_count') && isset($rule['purchase_history_products'])){
1779
  $allow_discount = false;
1780
  }
1781
  }
1782
+ if(isset($rules['exclude_categories'])){
1783
+ if(!empty($rules['exclude_categories']) && is_array($rules['exclude_categories'])){
1784
+ $matched = $this->checkCategoryMatches($product, $rules['exclude_categories']);
1785
+ if($matched){
1786
+ $allow_discount = false;
1787
+ }
1788
+ }
1789
+ }
1790
  if($allow_discount){
1791
  if(isset($rules['atleast_one_including_sub_categories'])){
1792
  if(!empty($rules['atleast_one_including_sub_categories']) && is_array($rules['atleast_one_including_sub_categories'])){
1850
  $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cartItem['data'], $rules, $rules_with_all_data);
1851
  if($matches){
1852
  $allow_discount = 1;
1853
+ $cart_item_quantity = (isset($cartItem['quantity']) && $cartItem['quantity']) ? $cartItem['quantity'] : 1;
1854
+ $sub_total += ((float)FlycartWoocommerceProduct::get_price($cartItem['data'], true)) * $cart_item_quantity;
1855
+ $quantity += $cart_item_quantity;
1856
  $item_count++;
1857
  }
1858
  }
1859
  }
 
1860
  if($allow_discount){
1861
  $ruleSuccess = 1;
1862
  if(is_array($rules) && count($rules)){
1894
  }
1895
  }
1896
  $this->categories_and_product_match_value = $ruleSuccess;
 
1897
  return $ruleSuccess;
1898
  }
1899
 
1953
 
1954
  public function calculate_conditional_subtotal($conditions, $rule) {
1955
  $cart_subtotal = 0;
1956
+ $rules = $rules_with_all_data = array();
1957
+ if(isset($rule['discount_rule'])){
1958
+ $rules = (is_string($rule['discount_rule']) ? json_decode($rule['discount_rule'], true) : array());
1959
+ $rules_with_all_data = $rules;
1960
+ // Simple array helper to re-arrange the structure.
1961
+ FlycartWooDiscountRulesGeneralHelper::reArrangeArray($rules);
1962
+ }
1963
  // Iterate over all cart items and
1964
  if(is_array($this->cart_items) && count($this->cart_items)){
1965
  foreach ($this->cart_items as $cart_item_key => $cart_item) {
1966
  $apply_discount = false;
 
 
 
 
 
1967
 
1968
+ if($this->has_category_in_rule || $this->has_product_specific_rule){
1969
+ $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cart_item['data'], $rules, $rules_with_all_data);
1970
+ if($matches){
1971
+ $apply_discount = true;
 
 
 
 
 
 
 
 
 
 
1972
  }
1973
  }
1974
 
2173
  $cart_subtotal_except_free = array_sum(array_column($cart,'subtotal')) - $free_item_price;
2174
  $cart_line_item_except_free = (count($cart)-$free_line_item);
2175
 
2176
+ $skipRuleType = array('categories_in', 'exclude_categories', 'in_each_category', 'atleast_one_including_sub_categories', 'products_in_list', 'products_not_in_list', 'exclude_sale_products');
2177
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
2178
  switch ($index) {
2179
  // Cart Subtotal.
2493
  case 'products_not_in_list':
2494
  case 'exclude_sale_products':
2495
  case 'categories_in':
2496
+ case 'exclude_categories':
2497
  case 'atleast_one_including_sub_categories':
2498
  case 'in_each_category':
2499
  if(count($rule)){
2504
  }
2505
  return false;
2506
  break;
2507
+ case 'customer_based_on_first_order':
2508
  case 'customer_based_on_purchase_history':
2509
  case 'customer_based_on_purchase_history_order_count':
2510
  case 'customer_based_on_purchase_history_product_order_count':
2517
  }
2518
  return false;
2519
  break;
2520
+ case 'create_dynamic_coupon':
2521
  case 'coupon_applied_any_one':
2522
  if(!empty($rule)){
2523
  $ruleSuccess = $this->validateCartCouponAppliedAnyOne($index, $rule, $rules);
includes/discount-base.php CHANGED
@@ -426,7 +426,7 @@ if (!class_exists('FlycartWooDiscountBase')) {
426
  'products_not_in' => 'product_to_apply',
427
 
428
  'categories_atleast_one' => 'category_to_apply',
429
- 'categories_not_in' => 'category_to_apply',
430
  'categories_in' => 'category_to_apply',
431
  'in_each_category' => 'category_to_apply',
432
  'atleast_one_including_sub_categories' => 'category_to_apply',
@@ -1035,7 +1035,7 @@ if (!class_exists('FlycartWooDiscountBase')) {
1035
  'fixed_item_count_tooltip' => esc_html__('Fixed item count - You need to provide item count manually. Dynamic item count - System will choose dynamically based on cart', 'woo-discount-rules'),
1036
  'item_count' => esc_html__('Item count', 'woo-discount-rules'),
1037
  'discount_number_of_item_tooltip' => esc_html__('Discount for number of item(s) in cart', 'woo-discount-rules'),
1038
- 'discount_number_of_each_item_tooltip' => esc_html__('Discount for number of quantity(ies) in each item', 'woo-discount-rules'),
1039
  'item_quantity' => esc_html__('Item quantity', 'woo-discount-rules'),
1040
  'place_holder_search_for_products' => esc_html__('Search for a products', 'woo-discount-rules'),
1041
  'and_text' => esc_html__('and', 'woo-discount-rules'),
@@ -1081,8 +1081,9 @@ if (!class_exists('FlycartWooDiscountBase')) {
1081
  'number_of_order_purchased_in_product' => esc_html__('Number of previous orders made with following products', 'woo-discount-rules'),
1082
  'number_of_order_quantity_purchased_in_product' => esc_html__('Number of quantity(s) in previous orders made with following products', 'woo-discount-rules'),
1083
  'coupon_applied' => esc_html__('Coupon applied', 'woo-discount-rules'),
1084
- 'atleast_any_one' => esc_html__('Atleast any one', 'woo-discount-rules'),
1085
- 'all_selected_coupon' => esc_html__('All selected', 'woo-discount-rules'),
 
1086
  'greater_than_or_equal_to' => esc_html__('Greater than or equal to', 'woo-discount-rules'),
1087
  'less_than_or_equal_to' => esc_html__('Less than or equal to', 'woo-discount-rules'),
1088
  'in_order_status' => esc_html__('and the order status should be', 'woo-discount-rules'),
@@ -1121,6 +1122,8 @@ if (!class_exists('FlycartWooDiscountBase')) {
1121
  'in_days' => esc_html__('in days', 'woo-discount-rules'),
1122
  'fixed_price' => esc_html__('Fixed Price Per Unit', 'woo-discount-rules'),
1123
  'set_discount' => esc_html__('Bundle (Set) Discount', 'woo-discount-rules'),
 
 
1124
  );
1125
  }
1126
 
426
  'products_not_in' => 'product_to_apply',
427
 
428
  'categories_atleast_one' => 'category_to_apply',
429
+ 'exclude_categories' => 'category_to_apply',
430
  'categories_in' => 'category_to_apply',
431
  'in_each_category' => 'category_to_apply',
432
  'atleast_one_including_sub_categories' => 'category_to_apply',
1035
  'fixed_item_count_tooltip' => esc_html__('Fixed item count - You need to provide item count manually. Dynamic item count - System will choose dynamically based on cart', 'woo-discount-rules'),
1036
  'item_count' => esc_html__('Item count', 'woo-discount-rules'),
1037
  'discount_number_of_item_tooltip' => esc_html__('Discount for number of item(s) in cart', 'woo-discount-rules'),
1038
+ 'discount_number_of_each_item_tooltip' => esc_html__('Discount for number of quantity(ies)', 'woo-discount-rules'),
1039
  'item_quantity' => esc_html__('Item quantity', 'woo-discount-rules'),
1040
  'place_holder_search_for_products' => esc_html__('Search for a products', 'woo-discount-rules'),
1041
  'and_text' => esc_html__('and', 'woo-discount-rules'),
1081
  'number_of_order_purchased_in_product' => esc_html__('Number of previous orders made with following products', 'woo-discount-rules'),
1082
  'number_of_order_quantity_purchased_in_product' => esc_html__('Number of quantity(s) in previous orders made with following products', 'woo-discount-rules'),
1083
  'coupon_applied' => esc_html__('Coupon applied', 'woo-discount-rules'),
1084
+ 'create_a_coupon' => esc_html__('Create your own coupon', 'woo-discount-rules'),
1085
+ 'atleast_any_one' => esc_html__('Atleast any one (Select from WooCommerce)', 'woo-discount-rules'),
1086
+ 'all_selected_coupon' => esc_html__('All selected (Select from WooCommerce)', 'woo-discount-rules'),
1087
  'greater_than_or_equal_to' => esc_html__('Greater than or equal to', 'woo-discount-rules'),
1088
  'less_than_or_equal_to' => esc_html__('Less than or equal to', 'woo-discount-rules'),
1089
  'in_order_status' => esc_html__('and the order status should be', 'woo-discount-rules'),
1122
  'in_days' => esc_html__('in days', 'woo-discount-rules'),
1123
  'fixed_price' => esc_html__('Fixed Price Per Unit', 'woo-discount-rules'),
1124
  'set_discount' => esc_html__('Bundle (Set) Discount', 'woo-discount-rules'),
1125
+ 'first_order_discount' => esc_html__('First Order discount', 'woo-discount-rules'),
1126
+ 'exclude_categories_in_cart' => esc_html__('Exclude categories in cart', 'woo-discount-rules'),
1127
  );
1128
  }
1129
 
includes/pricing-rules.php CHANGED
@@ -116,6 +116,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
116
  */
117
  public function save($request)
118
  {
 
 
 
119
  $id = (isset($request['rule_id']) ? $request['rule_id'] : false);
120
 
121
  $id = intval($id);
@@ -131,6 +134,30 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
131
 
132
  $request['rule_descr'] = (isset($request['rule_descr']) ? str_replace('\'', '', $request['rule_descr']) : '');
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  if ($id) {
135
  $post = array(
136
  'ID' => $id,
@@ -182,6 +209,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
182
  'product_to_exclude_variants',
183
  'product_to_apply_variants',
184
  'purchase_history_products_variants',
 
185
  );
186
 
187
  //----------------------------------------------------------------------------------------------------------
@@ -292,15 +320,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
292
  $request['product_based_condition'] = '{}';
293
  $request['product_based_discount'] = '{}';
294
  }
295
- $coupons_used = array();
296
  if(!isset($request['product_to_exclude'])) $request['product_to_exclude'] = array();
297
- if(!isset($request['coupons_to_apply'])) $request['coupons_to_apply'] = '';
298
- if(!empty($request['coupons_to_apply'])){
299
- if(isset($request['coupons_to_apply_option']) && $request['coupons_to_apply_option'] != 'none'){
300
- $coupons_used = $request['coupons_to_apply'];
301
- }
302
- $request['coupons_to_apply'] = implode(',', $request['coupons_to_apply']);
303
- }
304
 
305
  $request['status'] = 'publish';
306
  $request['wpml_language'] = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
@@ -319,6 +339,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
319
 
320
  //For update the last update time of rule
321
  $this->updateLastUpdateTimeOfRule();
 
 
322
  }
323
 
324
  /**
@@ -964,8 +986,10 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
964
  if(isset($rule->coupons_to_apply_option)){
965
  $rule_sets[$index]['allow']['coupon'] = $this->checkWithCouponApplied($rule);
966
  if($rule_sets[$index]['allow']['coupon']){
967
- if(!empty($rule->coupons_to_apply)){
968
  $coupons = explode(',', $rule->coupons_to_apply);
 
 
969
  FlycartWooDiscountRulesGeneralHelper::removeCouponPriceInCart($coupons);
970
  }
971
  }
@@ -1022,6 +1046,10 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1022
  if(isset($rule->coupons_to_apply) && $rule->coupons_to_apply != ''){
1023
  $allowed = $this->validatePriceCouponAppliedAllSelected($rule->coupons_to_apply);
1024
  }
 
 
 
 
1025
  }
1026
  }
1027
 
@@ -1109,6 +1137,11 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1109
  $email = FlycartWooDiscountRulesGeneralHelper::get_billing_email_from_post();
1110
  if($user || !empty($email)){
1111
  if(isset($rule->purchased_history_amount) && isset($rule->purchase_history_status_list)){
 
 
 
 
 
1112
  if($rule->purchased_history_amount >= 0){
1113
  $purchased_history_duration = isset($rule->purchased_history_duration)? $rule->purchased_history_duration: 'all_time';
1114
  $purchased_history_duration_days = isset($rule->purchased_history_duration_days)? $rule->purchased_history_duration_days: '';
@@ -1119,10 +1152,15 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1119
  'post_type' => wc_get_order_types(),
1120
  'post_status' => $purchase_history_status_list,
1121
  );
1122
- if(!empty($email)){
1123
- $query['meta_key'] = '_billing_email';
1124
- } else {
 
 
 
1125
  $query['meta_key'] = '_customer_user';
 
 
1126
  }
1127
  if($purchased_history_duration != 'all_time'){
1128
  $days = false;
@@ -1153,6 +1191,13 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1153
  $totalPurchasedAmount = $totalOrder = $totalQuantityPurchased = 0;
1154
  if(!empty($customerOrders)){
1155
  foreach ($customerOrders as $customerOrder) {
 
 
 
 
 
 
 
1156
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1157
  $total = FlycartWoocommerceOrder::get_total($order);
1158
  if($rule->based_on_purchase_history == 3 || $rule->based_on_purchase_history == 4){
@@ -1278,6 +1323,10 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1278
  foreach ($this->rule_sets as $id => $rule) {
1279
  $quantity = (isset($item['quantity']) ? $item['quantity'] : 0);
1280
 
 
 
 
 
1281
  //Exclude the bundled products items
1282
  $exclude_bundle_product_item = apply_filters('woo_discount_rules_exclude_woocommerce_bundled_item', true, $item);
1283
  if($exclude_bundle_product_item){
@@ -2755,7 +2804,16 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2755
  }
2756
  }
2757
  }
2758
- $status = apply_filters('woo_discount_rules_rule_matches_to_display_in_table', $status, $product, $rule);
 
 
 
 
 
 
 
 
 
2759
  if($status){
2760
  if ($rule->apply_to == 'specific_products') {
2761
 
@@ -2846,7 +2904,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2846
  // }
2847
  // }
2848
  }
2849
- $status = apply_filters('woo_discount_rules_rule_matches_to_display_in_table', $status, $product, $rule);
2850
  if ($status) {
2851
  $discount_range_data = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
2852
  if(!empty($discount_range_data)){
116
  */
117
  public function save($request)
118
  {
119
+ $result['status'] = 1;
120
+ $result['message'] = esc_html__('Saved successfully', 'woo-discount-rules');
121
+
122
  $id = (isset($request['rule_id']) ? $request['rule_id'] : false);
123
 
124
  $id = intval($id);
134
 
135
  $request['rule_descr'] = (isset($request['rule_descr']) ? str_replace('\'', '', $request['rule_descr']) : '');
136
 
137
+ $coupons_used = array();
138
+ if(!isset($request['coupons_to_apply'])) $request['coupons_to_apply'] = '';
139
+ if(!empty($request['coupons_to_apply'])){
140
+ if(isset($request['coupons_to_apply_option']) && $request['coupons_to_apply_option'] != 'none'){
141
+ $coupons_used = $request['coupons_to_apply'];
142
+ }
143
+ $request['coupons_to_apply'] = implode(',', $request['coupons_to_apply']);
144
+ }
145
+ if(isset($request['coupons_to_apply_option']) && $request['coupons_to_apply_option'] == 'create_dynamic_coupon'){
146
+ $validate_dynamic_coupon = FlycartWooDiscountRulesGeneralHelper::validateDynamicCoupon($request['dynamic_coupons_to_apply']);
147
+ $result['dynamic_coupons_to_apply'] = $validate_dynamic_coupon['coupon'];
148
+ if($validate_dynamic_coupon['status'] === true){
149
+ $request['dynamic_coupons_to_apply'] = $validate_dynamic_coupon['coupon'];
150
+ $coupons_used[] = $validate_dynamic_coupon['coupon'];
151
+ } else {
152
+ $result['status'] = 0;
153
+ $result['message'] = esc_html__('Failed to save', 'woo-discount-rules');
154
+ $result['error_message'] = $validate_dynamic_coupon['message'];
155
+ $result['invalid_field'] = 'dynamic_coupons_to_apply';
156
+ echo json_encode($result);
157
+ die();
158
+ }
159
+ }
160
+
161
  if ($id) {
162
  $post = array(
163
  'ID' => $id,
209
  'product_to_exclude_variants',
210
  'product_to_apply_variants',
211
  'purchase_history_products_variants',
212
+ 'dynamic_coupons_to_apply',
213
  );
214
 
215
  //----------------------------------------------------------------------------------------------------------
320
  $request['product_based_condition'] = '{}';
321
  $request['product_based_discount'] = '{}';
322
  }
 
323
  if(!isset($request['product_to_exclude'])) $request['product_to_exclude'] = array();
 
 
 
 
 
 
 
324
 
325
  $request['status'] = 'publish';
326
  $request['wpml_language'] = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
339
 
340
  //For update the last update time of rule
341
  $this->updateLastUpdateTimeOfRule();
342
+
343
+ echo json_encode($result);
344
  }
345
 
346
  /**
986
  if(isset($rule->coupons_to_apply_option)){
987
  $rule_sets[$index]['allow']['coupon'] = $this->checkWithCouponApplied($rule);
988
  if($rule_sets[$index]['allow']['coupon']){
989
+ if(!empty($rule->coupons_to_apply) || !empty($rule->dynamic_coupons_to_apply)){
990
  $coupons = explode(',', $rule->coupons_to_apply);
991
+ $dynamic_coupons = explode(',', $rule->dynamic_coupons_to_apply);
992
+ $coupons = array_merge($coupons, $dynamic_coupons);
993
  FlycartWooDiscountRulesGeneralHelper::removeCouponPriceInCart($coupons);
994
  }
995
  }
1046
  if(isset($rule->coupons_to_apply) && $rule->coupons_to_apply != ''){
1047
  $allowed = $this->validatePriceCouponAppliedAllSelected($rule->coupons_to_apply);
1048
  }
1049
+ } elseif ($rule->coupons_to_apply_option == 'create_dynamic_coupon'){
1050
+ if(isset($rule->dynamic_coupons_to_apply) && $rule->dynamic_coupons_to_apply != ''){
1051
+ $allowed = $this->validatePriceCouponAppliedAnyOne(trim($rule->dynamic_coupons_to_apply));
1052
+ }
1053
  }
1054
  }
1055
 
1137
  $email = FlycartWooDiscountRulesGeneralHelper::get_billing_email_from_post();
1138
  if($user || !empty($email)){
1139
  if(isset($rule->purchased_history_amount) && isset($rule->purchase_history_status_list)){
1140
+ if($rule->based_on_purchase_history == 'first_order' ){
1141
+ $rule->purchased_history_amount = 0;
1142
+ $rule->purchased_history_type = 'less_than_or_equal';
1143
+ $rule->purchased_history_duration = 'all_time';
1144
+ }
1145
  if($rule->purchased_history_amount >= 0){
1146
  $purchased_history_duration = isset($rule->purchased_history_duration)? $rule->purchased_history_duration: 'all_time';
1147
  $purchased_history_duration_days = isset($rule->purchased_history_duration_days)? $rule->purchased_history_duration_days: '';
1152
  'post_type' => wc_get_order_types(),
1153
  'post_status' => $purchase_history_status_list,
1154
  );
1155
+ if($rule->based_on_purchase_history == 'first_order' ){
1156
+ $query['post_status'] = 'any';
1157
+ $allowed = 'yes';
1158
+ }
1159
+ if($user){
1160
+ $query['meta_value'] = $user;
1161
  $query['meta_key'] = '_customer_user';
1162
+ } else {
1163
+ $query['meta_key'] = '_billing_email';
1164
  }
1165
  if($purchased_history_duration != 'all_time'){
1166
  $days = false;
1191
  $totalPurchasedAmount = $totalOrder = $totalQuantityPurchased = 0;
1192
  if(!empty($customerOrders)){
1193
  foreach ($customerOrders as $customerOrder) {
1194
+ if($rule->based_on_purchase_history == 'first_order' ){
1195
+ if(!in_array($customerOrder->post_status, array('wc-failed'))){
1196
+ return 'no';
1197
+ } else{
1198
+ continue;
1199
+ }
1200
+ }
1201
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1202
  $total = FlycartWoocommerceOrder::get_total($order);
1203
  if($rule->based_on_purchase_history == 3 || $rule->based_on_purchase_history == 4){
1323
  foreach ($this->rule_sets as $id => $rule) {
1324
  $quantity = (isset($item['quantity']) ? $item['quantity'] : 0);
1325
 
1326
+ //Exclude product from discount
1327
+ $exclude_product_item = apply_filters('woo_discount_rules_exclude_product_from_discount', false, $item['data'], $id, $rule, $item);
1328
+ if($exclude_product_item) continue;
1329
+
1330
  //Exclude the bundled products items
1331
  $exclude_bundle_product_item = apply_filters('woo_discount_rules_exclude_woocommerce_bundled_item', true, $item);
1332
  if($exclude_bundle_product_item){
2804
  }
2805
  }
2806
  }
2807
+ if(isset($rule->exclude_sale_items)){
2808
+ if($rule->exclude_sale_items){
2809
+ $product_is_on_sale = FlycartWoocommerceProduct::is_product_is_on_sale($product);
2810
+ if($product_is_on_sale){
2811
+ $status = false;
2812
+ }
2813
+ }
2814
+ }
2815
+
2816
+ $status = apply_filters('woo_discount_rules_rule_matches_to_display_in_table', $status, $product, $rule, $index);
2817
  if($status){
2818
  if ($rule->apply_to == 'specific_products') {
2819
 
2904
  // }
2905
  // }
2906
  }
2907
+ $status = apply_filters('woo_discount_rules_rule_matches_to_display_in_table', $status, $product, $rule, $index);
2908
  if ($status) {
2909
  $discount_range_data = (isset($rule->discount_range) ? json_decode($rule->discount_range) : array());
2910
  if(!empty($discount_range_data)){
loader.php CHANGED
@@ -415,7 +415,7 @@ if(!class_exists('FlycartWooDiscountRules')){
415
  add_filter('woocommerce_cart_item_price', array($this->pricingRules, 'replaceVisiblePricesCart'), 1000, 3);
416
 
417
  //replace visible price in product page
418
- add_filter('woocommerce_get_price_html', array($this->pricingRules, 'replaceVisiblePricesOptimized'), 100, 3);
419
  add_filter('woocommerce_get_price_html', array($this->pricingRules, 'replaceVisiblePricesForSalePriceAdjustment'), 9, 3);
420
 
421
  //replace visible price in product page for variant
@@ -475,6 +475,8 @@ if(!class_exists('FlycartWooDiscountRules')){
475
  // change template of sale tag
476
  add_filter('wc_get_template', array( 'FlycartWooDiscountBase', 'changeTemplateForSaleTag'), 10, 5);
477
  }
 
 
478
  }
479
 
480
  /**
415
  add_filter('woocommerce_cart_item_price', array($this->pricingRules, 'replaceVisiblePricesCart'), 1000, 3);
416
 
417
  //replace visible price in product page
418
+ add_filter('woocommerce_get_price_html', array($this->pricingRules, 'replaceVisiblePricesOptimized'), 1000, 3);
419
  add_filter('woocommerce_get_price_html', array($this->pricingRules, 'replaceVisiblePricesForSalePriceAdjustment'), 9, 3);
420
 
421
  //replace visible price in product page for variant
475
  // change template of sale tag
476
  add_filter('wc_get_template', array( 'FlycartWooDiscountBase', 'changeTemplateForSaleTag'), 10, 5);
477
  }
478
+
479
+ add_filter('woocommerce_get_shop_coupon_data', array('FlycartWooDiscountRulesGeneralHelper', 'addVirtualCoupon'), 9, 2);
480
  }
481
 
482
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.8.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -336,6 +336,22 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  = 1.8.0 - 03/10/19 =
340
  * Feature - Fixed price per unit option in price discount rules.
341
  * Feature - Bundle (Set) Discount option in price discount rules.
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.8.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
336
 
337
  == Changelog ==
338
 
339
+ = 1.8.1 - 21/10/19 =
340
+ * Feature - First order option in Purchase history.
341
+ * Feature - Category exclude option in cart rules.
342
+ * Feature - Create coupon option instead of selecting from woocommerce coupon for coupon based rules.
343
+ * Improvement - Increased the priority for the hook woocommerce_get_price_html to 1000
344
+ * Improvement - Event apply_filters('woo_discount_rules_exclude_product_from_discount', false, $item['data'], $id, $rule, $item);
345
+ * Improvement - Event update apply_filters('woo_discount_rules_rule_matches_to_display_in_table', $status, $product, $rule, $index);
346
+ * Improvement - Option to hide the discount table from front end while login as admin.
347
+ * Improvement - Removed options Any one cheapest from selected and Any one cheapest from all products.
348
+ * Improvement - Give priority to user for purchase history rule.
349
+ * Fix - Changed discount type for free product in cart option so the discount applies only for selected products.
350
+ * Fix - Currency switcher compatible for villa theme.
351
+ * Fix - Wrong subtotal calculation when exclude products is chosen.
352
+ * Fix - Timeout issue when returning customer in checkout for purchase history rule.
353
+ * Fix - Displaying discount table for on-sale product when exclude on-sale product option is enabled.
354
+
355
  = 1.8.0 - 03/10/19 =
356
  * Feature - Fixed price per unit option in price discount rules.
357
  * Feature - Bundle (Set) Discount option in price discount rules.
view/settings.php CHANGED
@@ -10,6 +10,18 @@ $data = $config;
10
  if (is_string($data)) $data = json_decode($data, true);
11
  $flycartWooDiscountRulesPurchase = new FlycartWooDiscountRulesPurchase();
12
  $isPro = $flycartWooDiscountRulesPurchase->isPro();
 
 
 
 
 
 
 
 
 
 
 
 
13
  ?>
14
 
15
  <div class="container-fluid woo_discount_loader_outer">
10
  if (is_string($data)) $data = json_decode($data, true);
11
  $flycartWooDiscountRulesPurchase = new FlycartWooDiscountRulesPurchase();
12
  $isPro = $flycartWooDiscountRulesPurchase->isPro();
13
+ $target = isset($_REQUEST['target'])? sanitize_text_field($_REQUEST['target']): '';
14
+ if($target === 'table'){
15
+ ?>
16
+ <script>
17
+ jQuery( document ).ready( function() {
18
+ jQuery('#discount_config a[href="#wdr_s_price_rules"]').trigger('click');
19
+ jQuery('#discount_config a[href="#wdr_price_rule_offer_table"]').trigger('click');
20
+ jQuery('#discount_config #show_discount_table').focus();
21
+ });
22
+ </script>
23
+ <?php
24
+ }
25
  ?>
26
 
27
  <div class="container-fluid woo_discount_loader_outer">
view/template/discount-table-advance.php CHANGED
@@ -71,4 +71,4 @@ $i = 1;
71
  }
72
  }
73
  ?>
74
- </div>
71
  }
72
  }
73
  ?>
74
+ </div>
view/template/discount-table.php CHANGED
@@ -12,55 +12,71 @@ $show_discount_table_header = isset($base_config['show_discount_table_header'])?
12
  $show_discount_title_table = isset($base_config['show_discount_title_table'])? $base_config['show_discount_title_table']: 'show';
13
  $show_column_range_table = isset($base_config['show_column_range_table'])? $base_config['show_column_range_table']: 'show';
14
  $show_column_discount_table = isset($base_config['show_column_discount_table'])? $base_config['show_column_discount_table']: 'show';
 
15
  ?>
16
- <table class="woo_discount_rules_table">
17
- <?php if($show_discount_table_header == 'show'){ ?>
18
- <thead>
19
- <tr class="wdr_tr_head">
20
- <?php if ($show_discount_title_table == 'show') { ?>
21
- <td class="wdr_td_head_title"><?php esc_html_e('Name', 'woo-discount-rules'); ?></td>
22
- <?php } ?>
23
- <?php if ($show_column_range_table == 'show') { ?>
24
- <td class="wdr_td_head_range"><?php esc_html_e('Range', 'woo-discount-rules'); ?></td>
25
- <?php } ?>
26
- <?php if ($show_column_discount_table == 'show') { ?>
27
- <td class="wdr_td_head_discount"><?php esc_html_e('Discount', 'woo-discount-rules'); ?></td>
28
- <?php } ?>
29
- </tr>
30
- </thead>
31
- <?php } ?>
32
- <tbody>
33
  <?php
34
- $have_discount = false;
35
- $table = $table_data;
36
- foreach ($table as $index => $item) {
37
- if ($item) {
38
- foreach ($item as $id => $value) {
39
- ?>
40
- <tr class="wdr_tr_body">
41
- <?php if ($show_discount_title_table == 'show') { ?>
42
- <td class="wdr_td_body_title"><?php echo $table_data_content[$index.$id]['title']; ?></td>
43
- <?php } ?>
44
- <?php if ($show_column_range_table == 'show') { ?>
45
- <td class="wdr_td_body_range"><?php echo $table_data_content[$index.$id]['condition']; ?></td>
46
- <?php } ?>
47
- <?php if ($show_column_discount_table == 'show') { ?>
48
- <td class="wdr_td_body_discount"><?php echo $table_data_content[$index.$id]['discount']; ?></td>
49
- <?php } ?>
50
- </tr>
51
- <?php }
52
- $have_discount = true;
53
- }
54
- }
55
- if (!$have_discount) {
56
  ?>
57
- <tr class="wdr_tr_body_no_discount">
58
- <td colspan="2">
59
- <?php esc_html_e('No Active Discounts.', 'woo-discount-rules'); ?>
60
- </td>
61
- </tr>
62
- <?php
 
63
  }
64
  ?>
65
- </tbody>
66
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  $show_discount_title_table = isset($base_config['show_discount_title_table'])? $base_config['show_discount_title_table']: 'show';
13
  $show_column_range_table = isset($base_config['show_column_range_table'])? $base_config['show_column_range_table']: 'show';
14
  $show_column_discount_table = isset($base_config['show_column_discount_table'])? $base_config['show_column_discount_table']: 'show';
15
+ $is_super_admin = is_super_admin();
16
  ?>
17
+ <div class="<?php echo ($is_super_admin)? 'wdr_table_container wdr_table_container_for_admin': 'wdr_table_container' ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  <?php
19
+ if($is_super_admin){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ?>
21
+ <div class="wdr_table_off_settings_link_con">
22
+ <a href="<?php echo admin_url("admin.php?page=woo_discount_rules&tab=settings&target=table"); ?>" target="_blank" class="wdr_table_off_settings_link">
23
+ <?php esc_html_e('Hide table', 'woo-discount-rules'); ?>
24
+ </a>
25
+ <span class="wdr_table_off_settings_hint"><?php esc_html_e('This effect displays only for you (Admin)', 'woo-discount-rules'); ?></span>
26
+ </div>
27
+ <?php
28
  }
29
  ?>
30
+
31
+ <table class="woo_discount_rules_table">
32
+ <?php if($show_discount_table_header == 'show'){ ?>
33
+ <thead>
34
+ <tr class="wdr_tr_head">
35
+ <?php if ($show_discount_title_table == 'show') { ?>
36
+ <td class="wdr_td_head_title"><?php esc_html_e('Name', 'woo-discount-rules'); ?></td>
37
+ <?php } ?>
38
+ <?php if ($show_column_range_table == 'show') { ?>
39
+ <td class="wdr_td_head_range"><?php esc_html_e('Range', 'woo-discount-rules'); ?></td>
40
+ <?php } ?>
41
+ <?php if ($show_column_discount_table == 'show') { ?>
42
+ <td class="wdr_td_head_discount"><?php esc_html_e('Discount', 'woo-discount-rules'); ?></td>
43
+ <?php } ?>
44
+ </tr>
45
+ </thead>
46
+ <?php } ?>
47
+ <tbody>
48
+ <?php
49
+ $have_discount = false;
50
+ $table = $table_data;
51
+ foreach ($table as $index => $item) {
52
+ if ($item) {
53
+ foreach ($item as $id => $value) {
54
+ ?>
55
+ <tr class="wdr_tr_body">
56
+ <?php if ($show_discount_title_table == 'show') { ?>
57
+ <td class="wdr_td_body_title"><?php echo $table_data_content[$index.$id]['title']; ?></td>
58
+ <?php } ?>
59
+ <?php if ($show_column_range_table == 'show') { ?>
60
+ <td class="wdr_td_body_range"><?php echo $table_data_content[$index.$id]['condition']; ?></td>
61
+ <?php } ?>
62
+ <?php if ($show_column_discount_table == 'show') { ?>
63
+ <td class="wdr_td_body_discount"><?php echo $table_data_content[$index.$id]['discount']; ?></td>
64
+ <?php } ?>
65
+ </tr>
66
+ <?php }
67
+ $have_discount = true;
68
+ }
69
+ }
70
+ if (!$have_discount) {
71
+ ?>
72
+ <tr class="wdr_tr_body_no_discount">
73
+ <td colspan="2">
74
+ <?php esc_html_e('No Active Discounts.', 'woo-discount-rules'); ?>
75
+ </td>
76
+ </tr>
77
+ <?php
78
+ }
79
+ ?>
80
+ </tbody>
81
+ </table>
82
+ </div>
view/view-cart-rules.php CHANGED
@@ -257,6 +257,12 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
257
  <?php if ($type == 'in_each_category') { ?> selected="selected"
258
  <?php } ?>><?php esc_html_e('In each category', 'woo-discount-rules'); ?>
259
  </option>
 
 
 
 
 
 
260
  </optgroup>
261
  <optgroup label="<?php esc_attr_e('Customer Details (must be logged in)', 'woo-discount-rules'); ?>">
262
  <option
@@ -357,6 +363,16 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
357
  </option>
358
  </optgroup>
359
  <optgroup label="<?php esc_attr_e('Purchase History', 'woo-discount-rules'); ?>">
 
 
 
 
 
 
 
 
 
 
360
  <option
361
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_based_on_purchase_history" <?php
362
  }
@@ -399,14 +415,24 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
399
  </option>
400
  </optgroup>
401
  <optgroup label="<?php esc_attr_e('Coupon applied', 'woo-discount-rules'); ?>">
 
 
 
 
 
 
 
 
 
 
402
  <option
403
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="coupon_applied_any_one" <?php
404
  }
405
  if ($type == 'coupon_applied_any_one') { ?> selected=selected <?php } ?>>
406
  <?php if (!$pro) { ?>
407
- <?php esc_html_e('Atleast any one', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
408
  <?php } else { ?>
409
- <?php esc_html_e('Atleast any one', 'woo-discount-rules'); ?>
410
  <?php } ?>
411
  </option>
412
  <option
@@ -414,9 +440,9 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
414
  }
415
  if ($type == 'coupon_applied_all_selected') { ?> selected=selected <?php } ?>>
416
  <?php if (!$pro) { ?>
417
- <?php esc_html_e('All selected', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
418
  <?php } else { ?>
419
- <?php esc_html_e('All selected', 'woo-discount-rules'); ?>
420
  <?php } ?>
421
  </option>
422
  </optgroup>
@@ -429,7 +455,7 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
429
  <label>
430
  <?php
431
  $inline_attr = '';
432
- if(in_array($type, array('exclude_sale_products'))){
433
  $inline_attr = ' style="display:none"';
434
  }
435
  ?>
@@ -452,7 +478,7 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
452
  <?php
453
  $category_list = array();
454
  $class = 'style="display:none"';
455
- if (in_array($type, array('categories_atleast_one', 'categories_not_in', 'categories_in', 'in_each_category', 'atleast_one_including_sub_categories'))) {
456
  $category_list = $discount_rules[$type];
457
  $class = 'style="display:block"';
458
  $hit = true;
@@ -587,6 +613,9 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
587
  $purchased_history_type = 'atleast';
588
  $purchased_history_duration = 'all_time';
589
  $purchase_history_status_list = $product_purchase_history_list = array();
 
 
 
590
  if ($type == 'customer_based_on_purchase_history' || $type == 'customer_based_on_purchase_history_order_count' || $type == 'customer_based_on_purchase_history_product_order_count' || $type == 'customer_based_on_purchase_history_product_quantity_count') {
591
  $purchase_history_status_list = isset($discount_rules[$type]['purchase_history_order_status'])? $discount_rules[$type]['purchase_history_order_status'] : array();
592
  $purchased_history_amount = isset($discount_rules[$type]['purchased_history_amount'])? $discount_rules[$type]['purchased_history_amount'] : 0;
@@ -651,13 +680,22 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
651
  } else {
652
  $class = 'style="display:block"';
653
  }
 
 
 
 
 
 
654
  ?>
655
  <div id="general_<?php echo $i; ?>" <?php echo $class; ?>>
656
  <input type="text"
657
- value="<?php echo(isset($discount_rules[$type]) && !is_array($discount_rules[$type]) ? $discount_rules[$type] : ''); ?>"
658
  name="discount_rule[<?php echo $i; ?>][option_value]">
659
  </div>
660
  </label>
 
 
 
661
  </div>
662
  <div class="col-md-1"><label> <?php esc_html_e('Action', 'woo-discount-rules'); ?> </label><br>
663
  <a href=javascript:void(0) class="btn btn-danger remove_cart_rule"><?php esc_html_e('Remove', 'woo-discount-rules'); ?></a>
257
  <?php if ($type == 'in_each_category') { ?> selected="selected"
258
  <?php } ?>><?php esc_html_e('In each category', 'woo-discount-rules'); ?>
259
  </option>
260
+ <option
261
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="exclude_categories" <?php
262
+ } ?>
263
+ <?php if ($type == 'exclude_categories') { ?> selected="selected"
264
+ <?php } ?>><?php esc_html_e('Exclude categories in cart', 'woo-discount-rules'); ?>
265
+ </option>
266
  </optgroup>
267
  <optgroup label="<?php esc_attr_e('Customer Details (must be logged in)', 'woo-discount-rules'); ?>">
268
  <option
363
  </option>
364
  </optgroup>
365
  <optgroup label="<?php esc_attr_e('Purchase History', 'woo-discount-rules'); ?>">
366
+ <option
367
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_based_on_first_order" <?php
368
+ }
369
+ if ($type == 'customer_based_on_first_order') { ?> selected=selected <?php } ?>>
370
+ <?php if (!$pro) { ?>
371
+ <?php esc_html_e('First Order discount', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
372
+ <?php } else { ?>
373
+ <?php esc_html_e('First Order discount', 'woo-discount-rules'); ?>
374
+ <?php } ?>
375
+ </option>
376
  <option
377
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_based_on_purchase_history" <?php
378
  }
415
  </option>
416
  </optgroup>
417
  <optgroup label="<?php esc_attr_e('Coupon applied', 'woo-discount-rules'); ?>">
418
+ <option
419
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="create_dynamic_coupon" <?php
420
+ }
421
+ if ($type == 'create_dynamic_coupon') { ?> selected=selected <?php } ?>>
422
+ <?php if (!$pro) { ?>
423
+ <?php esc_html_e('Create your own coupon', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
424
+ <?php } else { ?>
425
+ <?php esc_html_e('Create your own coupon', 'woo-discount-rules'); ?>
426
+ <?php } ?>
427
+ </option>
428
  <option
429
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="coupon_applied_any_one" <?php
430
  }
431
  if ($type == 'coupon_applied_any_one') { ?> selected=selected <?php } ?>>
432
  <?php if (!$pro) { ?>
433
+ <?php esc_html_e('Atleast any one (Select from WooCommerce)', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
434
  <?php } else { ?>
435
+ <?php esc_html_e('Atleast any one (Select from WooCommerce)', 'woo-discount-rules'); ?>
436
  <?php } ?>
437
  </option>
438
  <option
440
  }
441
  if ($type == 'coupon_applied_all_selected') { ?> selected=selected <?php } ?>>
442
  <?php if (!$pro) { ?>
443
+ <?php esc_html_e('All selected (Select from WooCommerce)', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
444
  <?php } else { ?>
445
+ <?php esc_html_e('All selected (Select from WooCommerce)', 'woo-discount-rules'); ?>
446
  <?php } ?>
447
  </option>
448
  </optgroup>
455
  <label>
456
  <?php
457
  $inline_attr = '';
458
+ if(in_array($type, array('exclude_sale_products', 'customer_based_on_first_order'))){
459
  $inline_attr = ' style="display:none"';
460
  }
461
  ?>
478
  <?php
479
  $category_list = array();
480
  $class = 'style="display:none"';
481
+ if (in_array($type, array('categories_atleast_one', 'categories_in', 'in_each_category', 'atleast_one_including_sub_categories', 'exclude_categories'))) {
482
  $category_list = $discount_rules[$type];
483
  $class = 'style="display:block"';
484
  $hit = true;
613
  $purchased_history_type = 'atleast';
614
  $purchased_history_duration = 'all_time';
615
  $purchase_history_status_list = $product_purchase_history_list = array();
616
+ if ($type == 'customer_based_on_first_order'){
617
+ $hit = true;
618
+ }
619
  if ($type == 'customer_based_on_purchase_history' || $type == 'customer_based_on_purchase_history_order_count' || $type == 'customer_based_on_purchase_history_product_order_count' || $type == 'customer_based_on_purchase_history_product_quantity_count') {
620
  $purchase_history_status_list = isset($discount_rules[$type]['purchase_history_order_status'])? $discount_rules[$type]['purchase_history_order_status'] : array();
621
  $purchased_history_amount = isset($discount_rules[$type]['purchased_history_amount'])? $discount_rules[$type]['purchased_history_amount'] : 0;
680
  } else {
681
  $class = 'style="display:block"';
682
  }
683
+ $dynamic_coupon_already_exists = false;
684
+ if($type == 'create_dynamic_coupon'){
685
+ if(!empty($discount_rules[$type])){
686
+ $dynamic_coupon_already_exists = FlycartWooDiscountRulesGeneralHelper::checkCouponAlreadyExistsInWooCommerce($discount_rules[$type]);
687
+ }
688
+ }
689
  ?>
690
  <div id="general_<?php echo $i; ?>" <?php echo $class; ?>>
691
  <input type="text"
692
+ class="form-control<?php echo ($dynamic_coupon_already_exists === true)? ' wdr_invalid': ''; ?>" value="<?php echo(isset($discount_rules[$type]) && !is_array($discount_rules[$type]) ? $discount_rules[$type] : ''); ?>"
693
  name="discount_rule[<?php echo $i; ?>][option_value]">
694
  </div>
695
  </label>
696
+ <div class="notice inline notice-alt notice-warning cart_rule_validation_error wdr_validation_notice" <?php echo ($dynamic_coupon_already_exists === true)? 'style="display:block;"': ''; ?>>
697
+ <?php echo ($dynamic_coupon_already_exists === true)? "<p>".esc_html__('Coupon already exists in WooCommerce. Please select another name', 'woo-discount-rules')."</p>": ''; ?>
698
+ </div>
699
  </div>
700
  <div class="col-md-1"><label> <?php esc_html_e('Action', 'woo-discount-rules'); ?> </label><br>
701
  <a href=javascript:void(0) class="btn btn-danger remove_cart_rule"><?php esc_html_e('Remove', 'woo-discount-rules'); ?></a>
view/view-pricing-rules.php CHANGED
@@ -371,11 +371,13 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
371
  if($pro){
372
  $coupons_to_apply_option = isset($data->coupons_to_apply_option) ? $data->coupons_to_apply_option : 'none';
373
  $coupons_to_apply = isset($data->coupons_to_apply) ? $data->coupons_to_apply : '';
 
374
  ?>
375
  <select class="selectpicker" id="coupon_option_price_rule" name="coupons_to_apply_option">
376
  <option value="none"<?php if ($coupons_to_apply_option == 'none') { ?> selected=selected <?php } ?>><?php esc_html_e('Do not use', 'woo-discount-rules'); ?></option>
377
- <option value="any_selected"<?php if ($coupons_to_apply_option == 'any_selected') { ?> selected=selected <?php } ?>><?php esc_html_e('Apply if any one coupon applied', 'woo-discount-rules'); ?></option>
378
- <option value="all_selected"<?php if ($coupons_to_apply_option == 'all_selected') { ?> selected=selected <?php } ?>><?php esc_html_e('Apply if all coupon applied', 'woo-discount-rules'); ?></option>
 
379
  </select>
380
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('coupon-based-discounts/activate-discount-rule-using-a-coupon-code-in-woocommerce', 'coupon');
381
 
@@ -386,7 +388,19 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
386
  }
387
 
388
  $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
 
 
 
 
 
 
389
  ?>
 
 
 
 
 
 
390
  <div class="coupons_to_apply_price_rule_con">
391
  <?php
392
  if($has_large_no_of_coupon){
@@ -491,6 +505,7 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
491
  ?>
492
  <select class="selectpicker" id="based_on_purchase_history" name="based_on_purchase_history">
493
  <option value="0"<?php if ($based_on_purchase_history == '0') { ?> selected=selected <?php } ?>><?php esc_html_e('Do not use', 'woo-discount-rules'); ?></option>
 
494
  <option value="1"<?php if ($based_on_purchase_history == '1') { ?> selected=selected <?php } ?>><?php esc_html_e('Purchased amount', 'woo-discount-rules'); ?></option>
495
  <option value="2"<?php if ($based_on_purchase_history == '2') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made', 'woo-discount-rules'); ?></option>
496
  <option value="3"<?php if ($based_on_purchase_history == '3') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made with following products', 'woo-discount-rules'); ?></option>
@@ -757,14 +772,22 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
757
  <?php
758
  $products_list = (isset($discount->discount_product) ? $discount->discount_product : array());
759
  $discount_product_option = (isset($discount->discount_product_option) ? $discount->discount_product_option : 'all');
 
 
 
 
 
 
 
 
 
 
760
  ?>
761
  <div class="price_discount_product_list_con">
762
  <?php esc_html_e('receive discount for', 'woo-discount-rules') ?>
763
  <select class="selectpicker discount_product_option" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_option]">
764
  <option value="all"<?php echo ($discount_product_option == 'all')? ' selected="selected"': '' ?>><?php esc_html_e('Auto add all selected products', 'woo-discount-rules') ?></option>
765
  <option value="same_product"<?php echo ($discount_product_option == 'same_product')? ' selected="selected"': '' ?>><?php esc_html_e('Same product', 'woo-discount-rules') ?></option>
766
- <option value="any_cheapest"<?php echo ($discount_product_option == 'any_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('Any one cheapest from selected', 'woo-discount-rules') ?></option>
767
- <option value="any_cheapest_from_all"<?php echo ($discount_product_option == 'any_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('Any one cheapest from all products', 'woo-discount-rules') ?></option>
768
  <option value="more_than_one_cheapest_from_cat"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_cat')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected category(ies)', 'woo-discount-rules') ?></option>
769
  <option value="more_than_one_cheapest"<?php echo ($discount_product_option == 'more_than_one_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected item(s)', 'woo-discount-rules') ?></option>
770
  <option value="more_than_one_cheapest_from_all"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest among all items in cart', 'woo-discount-rules') ?></option>
@@ -795,7 +818,7 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
795
  value="<?php echo(isset($discount->discount_product_items) ? $discount->discount_product_items : ''); ?>"
796
  placeholder="<?php esc_attr_e('ex. 1', 'woo-discount-rules'); ?>" />
797
  </label>
798
- <label><?php esc_html_e('Item quantity', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Discount for number of quantity(ies) in each item', 'woo-discount-rules'); ?>"></span>
799
  <input type="text"
800
  name="discount_range[<?php echo $fieldIndex; ?>][discount_product_qty]"
801
  class="form-control discount_product_qty"
371
  if($pro){
372
  $coupons_to_apply_option = isset($data->coupons_to_apply_option) ? $data->coupons_to_apply_option : 'none';
373
  $coupons_to_apply = isset($data->coupons_to_apply) ? $data->coupons_to_apply : '';
374
+ $dynamic_coupons_to_apply = isset($data->dynamic_coupons_to_apply) ? $data->dynamic_coupons_to_apply : '';
375
  ?>
376
  <select class="selectpicker" id="coupon_option_price_rule" name="coupons_to_apply_option">
377
  <option value="none"<?php if ($coupons_to_apply_option == 'none') { ?> selected=selected <?php } ?>><?php esc_html_e('Do not use', 'woo-discount-rules'); ?></option>
378
+ <option value="create_dynamic_coupon"<?php if ($coupons_to_apply_option == 'create_dynamic_coupon') { ?> selected=selected <?php } ?>><?php esc_html_e('Create your own coupon', 'woo-discount-rules'); ?></option>
379
+ <option value="any_selected"<?php if ($coupons_to_apply_option == 'any_selected') { ?> selected=selected <?php } ?>><?php esc_html_e('Apply if any one coupon applied (Select from WooCommerce)', 'woo-discount-rules'); ?></option>
380
+ <option value="all_selected"<?php if ($coupons_to_apply_option == 'all_selected') { ?> selected=selected <?php } ?>><?php esc_html_e('Apply if all coupon applied (Select from WooCommerce)', 'woo-discount-rules'); ?></option>
381
  </select>
382
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('coupon-based-discounts/activate-discount-rule-using-a-coupon-code-in-woocommerce', 'coupon');
383
 
388
  }
389
 
390
  $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
391
+ $dynamic_coupon_already_exists = false;
392
+ if($coupons_to_apply_option == 'create_dynamic_coupon'){
393
+ if(!empty($dynamic_coupons_to_apply)){
394
+ $dynamic_coupon_already_exists = FlycartWooDiscountRulesGeneralHelper::checkCouponAlreadyExistsInWooCommerce($dynamic_coupons_to_apply);
395
+ }
396
+ }
397
  ?>
398
+ <div class="dynamic_coupons_to_apply_price_rule_con">
399
+ <input type="text" class="form-control<?php echo ($dynamic_coupon_already_exists === true)? ' wdr_invalid': ''; ?>" name="dynamic_coupons_to_apply" value="<?php echo $dynamic_coupons_to_apply; ?>"/>
400
+ <div class="notice inline notice-alt notice-warning dynamic_coupons_to_apply_validation wdr_validation_notice" <?php echo ($dynamic_coupon_already_exists === true)? 'style="display:block;"': ''; ?>>
401
+ <?php echo ($dynamic_coupon_already_exists === true)? "<p>".esc_html__('Coupon already exists in WooCommerce. Please select another name', 'woo-discount-rules')."</p>": ''; ?>
402
+ </div>
403
+ </div>
404
  <div class="coupons_to_apply_price_rule_con">
405
  <?php
406
  if($has_large_no_of_coupon){
505
  ?>
506
  <select class="selectpicker" id="based_on_purchase_history" name="based_on_purchase_history">
507
  <option value="0"<?php if ($based_on_purchase_history == '0') { ?> selected=selected <?php } ?>><?php esc_html_e('Do not use', 'woo-discount-rules'); ?></option>
508
+ <option value="first_order"<?php if ($based_on_purchase_history === 'first_order') { ?> selected=selected <?php } ?>><?php esc_html_e('First Order discount', 'woo-discount-rules'); ?></option>
509
  <option value="1"<?php if ($based_on_purchase_history == '1') { ?> selected=selected <?php } ?>><?php esc_html_e('Purchased amount', 'woo-discount-rules'); ?></option>
510
  <option value="2"<?php if ($based_on_purchase_history == '2') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made', 'woo-discount-rules'); ?></option>
511
  <option value="3"<?php if ($based_on_purchase_history == '3') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made with following products', 'woo-discount-rules'); ?></option>
772
  <?php
773
  $products_list = (isset($discount->discount_product) ? $discount->discount_product : array());
774
  $discount_product_option = (isset($discount->discount_product_option) ? $discount->discount_product_option : 'all');
775
+ if(in_array($discount_product_option, array('any_cheapest', 'any_cheapest_from_all'))){
776
+ $discount->discount_product_item_type = 'dynamic';
777
+ if($discount_product_option == 'any_cheapest'){
778
+ $discount_product_option = 'more_than_one_cheapest';
779
+ $discount->discount_product_qty = 1;
780
+ } else {
781
+ $discount_product_option = 'more_than_one_cheapest_from_all';
782
+ $discount->discount_product_qty = 1;
783
+ }
784
+ }
785
  ?>
786
  <div class="price_discount_product_list_con">
787
  <?php esc_html_e('receive discount for', 'woo-discount-rules') ?>
788
  <select class="selectpicker discount_product_option" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_option]">
789
  <option value="all"<?php echo ($discount_product_option == 'all')? ' selected="selected"': '' ?>><?php esc_html_e('Auto add all selected products', 'woo-discount-rules') ?></option>
790
  <option value="same_product"<?php echo ($discount_product_option == 'same_product')? ' selected="selected"': '' ?>><?php esc_html_e('Same product', 'woo-discount-rules') ?></option>
 
 
791
  <option value="more_than_one_cheapest_from_cat"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_cat')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected category(ies)', 'woo-discount-rules') ?></option>
792
  <option value="more_than_one_cheapest"<?php echo ($discount_product_option == 'more_than_one_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected item(s)', 'woo-discount-rules') ?></option>
793
  <option value="more_than_one_cheapest_from_all"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest among all items in cart', 'woo-discount-rules') ?></option>
818
  value="<?php echo(isset($discount->discount_product_items) ? $discount->discount_product_items : ''); ?>"
819
  placeholder="<?php esc_attr_e('ex. 1', 'woo-discount-rules'); ?>" />
820
  </label>
821
+ <label><?php esc_html_e('Item quantity', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Discount for number of quantity(ies)', 'woo-discount-rules'); ?>"></span>
822
  <input type="text"
823
  name="discount_range[<?php echo $fieldIndex; ?>][discount_product_qty]"
824
  class="form-control discount_product_qty"
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.8.0
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.8.1
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/