Discount Rules for WooCommerce - Version 1.8.0

Version Description

  • 03/10/19 =
  • Feature - Fixed price per unit option in price discount rules.
  • Feature - Bundle (Set) Discount option in price discount rules.
  • Improvement - Survey while deactivate the plugin.
  • Improvement - Moved shipping country option under Customer shipping details in cart rules.
  • Fix - Reduced the priority of the hook woocommerce_get_price_html to 9 as it making conflict with wholesale plugin(sale price adjustment).
  • Fix - Woocommerce Currency Switcher - realmag777 Compatible for you saved text.
Download this release

Release Info

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

Code changes from version 1.7.20 to 1.8.0

assets/css/style.css CHANGED
@@ -216,4 +216,11 @@ form#discount_config .tab-content {
216
  }
217
  span.price_discount_amount_tool_tip{
218
  display: inline-block;
 
 
 
 
 
 
 
219
  }
216
  }
217
  span.price_discount_amount_tool_tip{
218
  display: inline-block;
219
+ }
220
+ .woo-side-button{
221
+ cursor: pointer;
222
+ }
223
+ .woo-side-panel p {
224
+ margin: 0 0 10px;
225
+ padding: 0;
226
  }
assets/js/app.js CHANGED
@@ -93,7 +93,7 @@ function validateWDRBOGOFields(){
93
  discount_product_percent_field.removeClass('wdr_invalid');
94
  }
95
  }
96
- } else if(jQuery.inArray(price_discount_type.val(), ['percentage_discount', 'price_discount']) !== -1){
97
  var price_discount_amount = jQuery(container).find('input.price_discount_amount');
98
  if(price_discount_amount.val() == '' || price_discount_amount.val() == null){
99
  price_discount_amount.addClass('wdr_invalid');
@@ -109,12 +109,14 @@ function validateWDRBOGOFields(){
109
  } else {
110
  discount_range_min_qty.removeClass('wdr_invalid');
111
  }
112
- var discount_range_max_qty = jQuery(container).find('input.discount_range_max_qty');
113
- if(discount_range_max_qty.val() == '' || discount_range_max_qty.val() == null){
114
- discount_range_max_qty.addClass('wdr_invalid');
115
- returnValue = false;
116
- } else {
117
- discount_range_max_qty.removeClass('wdr_invalid');
 
 
118
  }
119
  });
120
  }
@@ -134,6 +136,23 @@ function trigger_woocommerce_tooltip(){
134
  'delay': 200
135
  } );
136
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  (function ($) {
138
  jQuery(document).ready(function () {
139
  // Tooltips
@@ -297,12 +316,15 @@ function trigger_woocommerce_tooltip(){
297
  $('#addNewDiscountRange').on('click', function () {
298
  var count = $('.discount_rule_list').length + 1;
299
  if (is_pro) {
300
- var form = '<div class="discount_rule_list"> <div class="form-group"><label>'+woo_discount_localization.min_quantity+' <input type="text" name="discount_range[' + count + '][min_qty]" class="form-control discount_range_min_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'"></label>' +
301
- '<label>'+woo_discount_localization.max_quantity+' <input type="text" name="discount_range[' + count + '][max_qty]" class="form-control discount_range_max_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> </label> <label>'+woo_discount_localization.adjustment_type+'<select class="form-control price_discount_type" name="discount_range[' + count + '][discount_type]"> ' +
302
- '<option value="percentage_discount"> '+woo_discount_localization.percentage_discount_in_adjustment_type+' </option> <option value="price_discount">'+woo_discount_localization.price_discount+' </option> <option value="product_discount">'+woo_discount_localization.product_discount+' </option> </select></label> ' +
 
 
 
 
 
303
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
304
- '<span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="'+woo_discount_localization.percentage_discount_amount_tool_tip_text+'"></span>\n' +
305
- '<span class="woocommerce-help-tip price_discount_amount_tool_tip" data-tip="'+woo_discount_localization.price_discount_amount_tool_tip_text+'"></span>\n' +
306
  '</span></label>' +
307
  '<label><span class="hide-for-product-discount">'+woo_discount_localization.value_text+'</span>' +
308
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> ';
@@ -350,11 +372,10 @@ function trigger_woocommerce_tooltip(){
350
  form += '</label>&nbsp;<label><a href=javascript:void(0) class="btn btn-danger form-control remove_discount_range">'+woo_discount_localization.remove_text+'</a></label> ';
351
  form += '<label><a href="javascript:void(0)" data-id="'+count+'" class="btn btn-primary form-control create_duplicate_discount_range">'+woo_discount_localization.duplicate_text+'</a></label> </div> </div>';
352
  } else {
353
- var form = '<div class="discount_rule_list"> <div class="form-group"><label>'+woo_discount_localization.min_quantity+' <input type="text" name="discount_range[' + count + '][min_qty]" class="form-control discount_range_min_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'"></label>' +
354
- '<label>'+woo_discount_localization.max_quantity+' <input type="text" name="discount_range[' + count + '][max_qty]" class="form-control discount_range_max_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> </label> <label>'+woo_discount_localization.adjustment_type+'<select class="form-control price_discount_type" name="discount_range[' + count + '][discount_type]"> ' +
355
- '<option value="percentage_discount"> '+woo_discount_localization.percentage_discount_in_adjustment_type+' </option> <option disabled>'+woo_discount_localization.price_discount+' <b>' + pro_suffix + '</b> </option> <option disabled>'+woo_discount_localization.product_discount+' <b>' + pro_suffix + '</b> </option> </select></label>' +
356
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
357
- '<span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="'+woo_discount_localization.percentage_discount_amount_tool_tip_text+'"></span>\n'+
358
  '</span></label>' +
359
  '<label>'+woo_discount_localization.value_text+' ' +
360
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> ';
@@ -649,11 +670,13 @@ function trigger_woocommerce_tooltip(){
649
  '<option value="atleast_one_including_sub_categories">'+woo_discount_localization.atleast_one_including_sub_categories+'</option>' +
650
  '<option value="in_each_category">'+woo_discount_localization.in_each_category_cart+'</option>' +
651
  '</optgroup>' +
652
- '<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><option value="shipping_countries_in">'+woo_discount_localization.shipping_country_list+'</option></optgroup>' +
653
  '<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>' +
654
  '<optgroup label="'+woo_discount_localization.customer_billing_details+'"><option value="customer_billing_city">'+woo_discount_localization.customer_billing_city+'</option></optgroup>' +
655
- '<optgroup label="'+woo_discount_localization.customer_shipping_details+'"><option value="customer_shipping_state">'+woo_discount_localization.customer_shipping_state+'</option>' +
656
  '<option value="customer_shipping_city">'+woo_discount_localization.customer_shipping_city+'</option>' +
 
 
657
  '<option value="customer_shipping_zip_code">'+woo_discount_localization.customer_shipping_zip_code+'</option></optgroup>' +
658
  '<optgroup label="'+woo_discount_localization.purchase_history+'">' +
659
  '<option value="customer_based_on_purchase_history">'+woo_discount_localization.purchased_amount+'</option>'+
@@ -721,11 +744,13 @@ function trigger_woocommerce_tooltip(){
721
  '<option disabled>'+woo_discount_localization.atleast_one_including_sub_categories+' <b>' + pro_suffix + '</b></option>' +
722
  '<option disabled>'+woo_discount_localization.in_each_category_cart+' <b>' + pro_suffix + '</b></option>' +
723
  '</optgroup>' +
724
- '<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><option disabled>'+woo_discount_localization.shipping_country_list+' <b>' + pro_suffix + '</b></option></optgroup>' +
725
  '<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>' +
726
  '<optgroup label="'+woo_discount_localization.customer_billing_details+'"><option disabled>'+woo_discount_localization.customer_billing_city+' <b>' + pro_suffix + '</b></option></optgroup>' +
727
- '<optgroup label="'+woo_discount_localization.customer_shipping_details+'"><option disabled>'+woo_discount_localization.customer_shipping_state+' <b>' + pro_suffix + '</b></option>' +
728
  '<option disabled>'+woo_discount_localization.customer_shipping_city+' <b>' + pro_suffix + '</b></option>' +
 
 
729
  '<option disabled>'+woo_discount_localization.customer_shipping_zip_code+' <b>' + pro_suffix + '</b></option></optgroup>' +
730
  '<optgroup label="'+woo_discount_localization.purchase_history+'"><option disabled>'+woo_discount_localization.purchased_amount+' <b>' + pro_suffix + '</b></option>' +
731
  '<option disabled>'+woo_discount_localization.number_of_order_purchased+' <b>' + pro_suffix + '</b></option>' +
@@ -816,6 +841,10 @@ function trigger_woocommerce_tooltip(){
816
  var discount_amount = $(this).closest('.discount_rule_list').find('.price_discount_amount');
817
  var price_discount_amount = $(this).closest('.discount_rule_list').find('.price_discount_product_list_con');
818
  var discount_product_percent_con = $(this).closest('.discount_rule_list').find('.discount_product_percent_con');
 
 
 
 
819
  if($(this).val() == 'product_discount'){
820
  discount_amount.hide();
821
  price_discount_amount.removeClass('hide').show();
@@ -826,14 +855,36 @@ function trigger_woocommerce_tooltip(){
826
  price_discount_amount.hide();
827
  discount_product_percent_con.hide();
828
  $(this).closest('.discount_rule_list').find('.hide-for-product-discount').show();
829
- $(this).closest('.discount_rule_list').find('.percentage_discount_amount_tool_tip, .price_discount_amount_tool_tip').hide();
830
  if($(this).val() == 'percentage_discount'){
831
- $(this).closest('.discount_rule_list').find('.percentage_discount_amount_tool_tip').show();
 
 
 
 
832
  } else {
833
- $(this).closest('.discount_rule_list').find('.price_discount_amount_tool_tip').show();
834
  }
 
835
 
836
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  });
838
  $('.price_discount_type').trigger('change');
839
 
93
  discount_product_percent_field.removeClass('wdr_invalid');
94
  }
95
  }
96
+ } else if(jQuery.inArray(price_discount_type.val(), ['percentage_discount', 'price_discount', 'fixed_price', 'set_discount']) !== -1){
97
  var price_discount_amount = jQuery(container).find('input.price_discount_amount');
98
  if(price_discount_amount.val() == '' || price_discount_amount.val() == null){
99
  price_discount_amount.addClass('wdr_invalid');
109
  } else {
110
  discount_range_min_qty.removeClass('wdr_invalid');
111
  }
112
+ if(price_discount_type.val() != 'set_discount'){
113
+ var discount_range_max_qty = jQuery(container).find('input.discount_range_max_qty');
114
+ if(discount_range_max_qty.val() == '' || discount_range_max_qty.val() == null){
115
+ discount_range_max_qty.addClass('wdr_invalid');
116
+ returnValue = false;
117
+ } else {
118
+ discount_range_max_qty.removeClass('wdr_invalid');
119
+ }
120
  }
121
  });
122
  }
136
  'delay': 200
137
  } );
138
  }
139
+
140
+ function wooo_discount_range_altered() {
141
+ var result = { 'has_set_discount': false, 'has_range_discount': false, 'has_fixed_price': false };
142
+ var discount_types = jQuery('#discount_rule_list').find("select.price_discount_type");
143
+ jQuery.each(discount_types, function( key, current_val ) {
144
+ var adjustment_type = jQuery(current_val).val();
145
+ if(adjustment_type == 'set_discount'){
146
+ result.has_set_discount = true;
147
+ } else if(adjustment_type == 'fixed_price'){
148
+ result.has_fixed_price = true;
149
+ result.has_range_discount = true;
150
+ } else {
151
+ result.has_range_discount = true;
152
+ }
153
+ });
154
+ return result;
155
+ }
156
  (function ($) {
157
  jQuery(document).ready(function () {
158
  // Tooltips
316
  $('#addNewDiscountRange').on('click', function () {
317
  var count = $('.discount_rule_list').length + 1;
318
  if (is_pro) {
319
+ var discount_types = wooo_discount_range_altered();
320
+ var discount_type_set_discount_selected = ''
321
+ if(discount_types.has_set_discount == true){
322
+ discount_type_set_discount_selected = ' selected="selected" '
323
+ }
324
+ var form = '<div class="discount_rule_list"> <div class="form-group"><label><span class="discount_for_min_quantity_text">'+woo_discount_localization.min_quantity+'</span> <input type="text" name="discount_range[' + count + '][min_qty]" class="form-control discount_range_min_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'"></label>' +
325
+ '<label class="discount_for_max_quantity_label">'+woo_discount_localization.max_quantity+' <input type="text" name="discount_range[' + count + '][max_qty]" class="form-control discount_range_max_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> </label> <label>'+woo_discount_localization.adjustment_type+'<select class="form-control price_discount_type" name="discount_range[' + count + '][discount_type]"> ' +
326
+ '<option value="percentage_discount"> '+woo_discount_localization.percentage_discount_in_adjustment_type+' </option> <option value="price_discount">'+woo_discount_localization.price_discount+' </option> <option value="fixed_price">'+woo_discount_localization.fixed_price+' </option> <option value="set_discount" '+discount_type_set_discount_selected+'>'+woo_discount_localization.set_discount+' </option> <option value="product_discount">'+woo_discount_localization.product_discount+' </option> </select></label> ' +
327
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
 
 
328
  '</span></label>' +
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+'"> ';
372
  form += '</label>&nbsp;<label><a href=javascript:void(0) class="btn btn-danger form-control remove_discount_range">'+woo_discount_localization.remove_text+'</a></label> ';
373
  form += '<label><a href="javascript:void(0)" data-id="'+count+'" class="btn btn-primary form-control create_duplicate_discount_range">'+woo_discount_localization.duplicate_text+'</a></label> </div> </div>';
374
  } else {
375
+ var form = '<div class="discount_rule_list"> <div class="form-group"><label><span class="discount_for_min_quantity_text">'+woo_discount_localization.min_quantity+'</span> <input type="text" name="discount_range[' + count + '][min_qty]" class="form-control discount_range_min_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'"></label>' +
376
+ '<label class="discount_for_max_quantity_label">'+woo_discount_localization.max_quantity+' <input type="text" name="discount_range[' + count + '][max_qty]" class="form-control discount_range_max_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> </label> <label>'+woo_discount_localization.adjustment_type+'<select class="form-control price_discount_type" name="discount_range[' + count + '][discount_type]"> ' +
377
+ '<option value="percentage_discount"> '+woo_discount_localization.percentage_discount_in_adjustment_type+' </option> <option disabled>'+woo_discount_localization.price_discount+' <b>' + pro_suffix + '</b> </option> <option disabled>'+woo_discount_localization.fixed_price+' <b>' + pro_suffix + '</b> </option> <option disabled>'+woo_discount_localization.set_discount+' <b>' + pro_suffix + '</b> </option> <option disabled>'+woo_discount_localization.product_discount+' <b>' + pro_suffix + '</b> </option> </select></label>' +
378
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
 
379
  '</span></label>' +
380
  '<label>'+woo_discount_localization.value_text+' ' +
381
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> ';
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>' +
675
  '<optgroup label="'+woo_discount_localization.customer_billing_details+'"><option value="customer_billing_city">'+woo_discount_localization.customer_billing_city+'</option></optgroup>' +
676
+ '<optgroup label="'+woo_discount_localization.customer_shipping_details+'">' +
677
  '<option value="customer_shipping_city">'+woo_discount_localization.customer_shipping_city+'</option>' +
678
+ '<option value="customer_shipping_state">'+woo_discount_localization.customer_shipping_state+'</option>' +
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>'+
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>' +
749
  '<optgroup label="'+woo_discount_localization.customer_billing_details+'"><option disabled>'+woo_discount_localization.customer_billing_city+' <b>' + pro_suffix + '</b></option></optgroup>' +
750
+ '<optgroup label="'+woo_discount_localization.customer_shipping_details+'">' +
751
  '<option disabled>'+woo_discount_localization.customer_shipping_city+' <b>' + pro_suffix + '</b></option>' +
752
+ '<option disabled>'+woo_discount_localization.customer_shipping_state+' <b>' + pro_suffix + '</b></option>' +
753
+ '<option disabled>'+woo_discount_localization.shipping_country_list+' <b>' + pro_suffix + '</b></option>' +
754
  '<option disabled>'+woo_discount_localization.customer_shipping_zip_code+' <b>' + pro_suffix + '</b></option></optgroup>' +
755
  '<optgroup label="'+woo_discount_localization.purchase_history+'"><option disabled>'+woo_discount_localization.purchased_amount+' <b>' + pro_suffix + '</b></option>' +
756
  '<option disabled>'+woo_discount_localization.number_of_order_purchased+' <b>' + pro_suffix + '</b></option>' +
841
  var discount_amount = $(this).closest('.discount_rule_list').find('.price_discount_amount');
842
  var price_discount_amount = $(this).closest('.discount_rule_list').find('.price_discount_product_list_con');
843
  var discount_product_percent_con = $(this).closest('.discount_rule_list').find('.discount_product_percent_con');
844
+ var discount_for_min_quantity_text = $(this).closest('.discount_rule_list').find('.discount_for_min_quantity_text');
845
+ var discount_for_max_quantity_label = $(this).closest('.discount_rule_list').find('.discount_for_max_quantity_label');
846
+ discount_for_max_quantity_label.show();
847
+ discount_for_min_quantity_text.html(woo_discount_localization.min_quantity);
848
  if($(this).val() == 'product_discount'){
849
  discount_amount.hide();
850
  price_discount_amount.removeClass('hide').show();
855
  price_discount_amount.hide();
856
  discount_product_percent_con.hide();
857
  $(this).closest('.discount_rule_list').find('.hide-for-product-discount').show();
858
+ var discount_type_tool_tip_con = $(this).closest('.discount_rule_list').find('.price_discount_amount_tool_tip_con');
859
  if($(this).val() == 'percentage_discount'){
860
+ discount_type_tool_tip_con.html('<span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="'+woo_discount_localization.percentage_discount_amount_tool_tip_text+'"></span>');
861
+ } else if($(this).val() == 'fixed_price'){
862
+ discount_type_tool_tip_con.html('<span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="'+woo_discount_localization.fixed_price_discount_amount_tool_tip_text+'"></span>');
863
+ } else if($(this).val() == 'set_discount'){
864
+ discount_type_tool_tip_con.html('<span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="'+woo_discount_localization.set_discount_amount_tool_tip_text+'"></span>');
865
  } else {
866
+ discount_type_tool_tip_con.html('<span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="'+woo_discount_localization.price_discount_amount_tool_tip_text+'"></span>');
867
  }
868
+ trigger_woocommerce_tooltip();
869
 
870
  }
871
+ if($(this).val() == 'set_discount'){
872
+ discount_for_max_quantity_label.hide();
873
+ discount_for_min_quantity_text.html(woo_discount_localization.set_quantity);
874
+ }
875
+ var discount_types = wooo_discount_range_altered();
876
+ $('.set_discount_info_text, .fixed_price_discount_info_text').hide();
877
+ if(discount_types.has_set_discount == true){
878
+ $('.set_discount_info_text').show();
879
+ }
880
+ if(discount_types.has_fixed_price == true){
881
+ $('.fixed_price_discount_info_text').show();
882
+ }
883
+ if(discount_types.has_set_discount == true && discount_types.has_range_discount == true ){
884
+ $('.set_discount_with_range_warning').show();
885
+ } else {
886
+ $('.set_discount_with_range_warning').hide();
887
+ }
888
  });
889
  $('.price_discount_type').trigger('change');
890
 
helper/general-helper.php CHANGED
@@ -734,12 +734,25 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
734
  * */
735
  public static function docsURL($url, $utm_term){
736
  $url_prefix = 'https://docs.flycart.org/woocommerce-discount-rules/';
737
- $utm = '?utm_source=woo-discount-rules&utm_campaign=doc&utm_medium=text-click&';
738
  $url = trim($url, '/');
739
 
740
  return $url_prefix.$url.$utm.$utm_term;
741
  }
742
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
  /**
744
  * Docs HTML
745
  * @param string $url
734
  * */
735
  public static function docsURL($url, $utm_term){
736
  $url_prefix = 'https://docs.flycart.org/woocommerce-discount-rules/';
737
+ $utm = '?utm_source=woo-discount-rules&utm_campaign=doc&utm_medium=text-click&utm_content=';
738
  $url = trim($url, '/');
739
 
740
  return $url_prefix.$url.$utm.$utm_term;
741
  }
742
 
743
+ /**
744
+ * Docs HTML
745
+ * @param string $url
746
+ * @param string $utm_term
747
+ * @return string
748
+ * */
749
+ public static function docsDirectURL($url, $utm_term){
750
+ $utm = '?utm_source=woo-discount-rules&utm_campaign=doc&utm_medium=text-click&utm_content=';
751
+ $url = trim($url, '/');
752
+
753
+ return $url.$utm.$utm_term;
754
+ }
755
+
756
  /**
757
  * Docs HTML
758
  * @param string $url
i18n/languages/woo-discount-rules.pot CHANGED
@@ -39,7 +39,7 @@ msgstr ""
39
  msgid "Your server current date and time: "
40
  msgstr ""
41
 
42
- #: helper/general-helper.php:755
43
  msgid "Read Docs"
44
  msgstr ""
45
 
@@ -125,7 +125,7 @@ msgid "Free Shipping"
125
  msgstr ""
126
 
127
  #: includes/advanced/free_shipping_method.php:73
128
- #: includes/discount-base.php:1049 view/cart-rules.php:133
129
  #: view/pricing-rules.php:163 view/settings_promotion.php:65
130
  #: view/settings_promotion.php:100
131
  msgid "Enable"
@@ -214,426 +214,442 @@ msgstr ""
214
  msgid "Please enter a Key"
215
  msgstr ""
216
 
217
- #: includes/discount-base.php:1009 view/view-pricing-rules.php:675
218
  msgid "Min Quantity"
219
  msgstr ""
220
 
221
- #: includes/discount-base.php:1010 view/view-pricing-rules.php:682
222
  msgid "Max Quantity"
223
  msgstr ""
224
 
225
- #: includes/discount-base.php:1011 view/view-cart-rules.php:92
226
- #: view/view-pricing-rules.php:74 view/view-pricing-rules.php:680
227
- #: view/view-pricing-rules.php:753 view/view-pricing-rules.php:770
228
- #: view/view-pricing-rules.php:777
 
 
 
 
 
229
  msgid "ex. 1"
230
  msgstr ""
231
 
232
- #: includes/discount-base.php:1012 view/view-pricing-rules.php:815
233
  msgid "ex. 10"
234
  msgstr ""
235
 
236
- #: includes/discount-base.php:1013 view/view-pricing-rules.php:687
237
- #: view/view-pricing-rules.php:729
238
  msgid "ex. 50"
239
  msgstr ""
240
 
241
- #: includes/discount-base.php:1014
242
  msgid "Search for a user"
243
  msgstr ""
244
 
245
- #: includes/discount-base.php:1015 view/view-pricing-rules.php:688
246
  msgid "Adjustment Type"
247
  msgstr ""
248
 
249
- #: includes/discount-base.php:1016 view/view-pricing-rules.php:804
250
  msgid "Discount percentage"
251
  msgstr ""
252
 
253
- #: includes/discount-base.php:1017 view/view-cart-rules.php:700
254
- #: view/view-pricing-rules.php:694
255
  msgid "Percentage Discount"
256
  msgstr ""
257
 
258
- #: includes/discount-base.php:1018 view/view-cart-rules.php:706
259
- #: view/view-cart-rules.php:708 view/view-pricing-rules.php:702
260
- #: view/view-pricing-rules.php:704
261
  msgid "Price Discount"
262
  msgstr ""
263
 
264
- #: includes/discount-base.php:1019 view/view-pricing-rules.php:712
265
- #: view/view-pricing-rules.php:714
266
  msgid "BOGO Product Discount"
267
  msgstr ""
268
 
269
- #: includes/discount-base.php:1020
270
  msgid "Product Discount - Not support for subtotal based rule"
271
  msgstr ""
272
 
273
- #: includes/discount-base.php:1021 view/view-cart-rules.php:436
274
- #: view/view-pricing-rules.php:724 view/view-pricing-rules.php:844
275
  msgid "Value"
276
  msgstr ""
277
 
278
- #: includes/discount-base.php:1022 view/view-pricing-rules.php:736
279
  msgid "receive discount for"
280
  msgstr ""
281
 
282
- #: includes/discount-base.php:1023 view/view-pricing-rules.php:738
283
  msgid "Auto add all selected products"
284
  msgstr ""
285
 
286
- #: includes/discount-base.php:1024 view/view-pricing-rules.php:739
287
  msgid "Same product"
288
  msgstr ""
289
 
290
- #: includes/discount-base.php:1025 view/view-pricing-rules.php:740
291
  msgid "Any one cheapest from selected"
292
  msgstr ""
293
 
294
- #: includes/discount-base.php:1026 view/view-pricing-rules.php:741
295
  msgid "Any one cheapest from all products"
296
  msgstr ""
297
 
298
- #: includes/discount-base.php:1027 view/view-pricing-rules.php:742
299
  msgid "Cheapest in cart - selected category(ies)"
300
  msgstr ""
301
 
302
- #: includes/discount-base.php:1028 view/view-pricing-rules.php:743
303
  msgid "Cheapest in cart - selected item(s)"
304
  msgstr ""
305
 
306
- #: includes/discount-base.php:1029 view/view-pricing-rules.php:744
307
  msgid "Cheapest among all items in cart"
308
  msgstr ""
309
 
310
- #: includes/discount-base.php:1030 view/view-pricing-rules.php:748
311
  msgid "Free quantity"
312
  msgstr ""
313
 
314
- #: includes/discount-base.php:1031 view/view-pricing-rules.php:748
315
  msgid "Number of quantity(ies) in each selected product(s)"
316
  msgstr ""
317
 
318
- #: includes/discount-base.php:1032 view/view-pricing-rules.php:762
319
  msgid "Fixed item count (not recommended)"
320
  msgstr ""
321
 
322
- #: includes/discount-base.php:1033 view/view-pricing-rules.php:761
323
  msgid "Dynamic item count"
324
  msgstr ""
325
 
326
- #: includes/discount-base.php:1034 view/view-pricing-rules.php:764
327
  msgid ""
328
  "Fixed item count - You need to provide item count manually. Dynamic item "
329
  "count - System will choose dynamically based on cart"
330
  msgstr ""
331
 
332
- #: includes/discount-base.php:1035 view/view-pricing-rules.php:765
333
  msgid "Item count"
334
  msgstr ""
335
 
336
- #: includes/discount-base.php:1036 view/view-pricing-rules.php:765
337
  msgid "Discount for number of item(s) in cart"
338
  msgstr ""
339
 
340
- #: includes/discount-base.php:1037 view/view-pricing-rules.php:772
341
  msgid "Discount for number of quantity(ies) in each item"
342
  msgstr ""
343
 
344
- #: includes/discount-base.php:1038 view/view-pricing-rules.php:772
345
  msgid "Item quantity"
346
  msgstr ""
347
 
348
- #: includes/discount-base.php:1039
349
  msgid "Search for a products"
350
  msgstr ""
351
 
352
- #: includes/discount-base.php:1040
353
  msgid "and"
354
  msgstr ""
355
 
356
- #: includes/discount-base.php:1041 view/view-pricing-rules.php:806
357
  msgid "100% percent"
358
  msgstr ""
359
 
360
- #: includes/discount-base.php:1042 view/view-pricing-rules.php:807
361
  msgid "Limited percent"
362
  msgstr ""
363
 
364
- #: includes/discount-base.php:1043
365
  msgid "Percentage"
366
  msgstr ""
367
 
368
- #: includes/discount-base.php:1044
369
  msgid "as discount"
370
  msgstr ""
371
 
372
- #: includes/discount-base.php:1045 view/view-cart-rules.php:663
373
- #: view/view-pricing-rules.php:821
374
  msgid "Remove"
375
  msgstr ""
376
 
377
- #: includes/discount-base.php:1046 view/cart-rules.php:170
378
- #: view/pricing-rules.php:200 view/view-pricing-rules.php:824
379
  msgid "Duplicate"
380
  msgstr ""
381
 
382
- #: includes/discount-base.php:1047
383
  msgid "none"
384
  msgstr ""
385
 
386
- #: includes/discount-base.php:1048
387
  msgid "Are you sure to remove this ?"
388
  msgstr ""
389
 
390
- #: includes/discount-base.php:1050 view/cart-rules.php:130
391
  #: view/pricing-rules.php:160
392
  msgid "Disable"
393
  msgstr ""
394
 
395
- #: includes/discount-base.php:1051
396
  msgid "Are you sure to remove ?"
397
  msgstr ""
398
 
399
- #: includes/discount-base.php:1052 view/view-cart-rules.php:172
400
  msgid "Type"
401
  msgstr ""
402
 
403
- #: includes/discount-base.php:1053 view/view-cart-rules.php:176
404
  msgid "Cart Subtotal"
405
  msgstr ""
406
 
407
- #: includes/discount-base.php:1054 view/view-cart-rules.php:179
408
  msgid "Subtotal at least"
409
  msgstr ""
410
 
411
- #: includes/discount-base.php:1055 view/view-cart-rules.php:183
412
  msgid "Subtotal less than"
413
  msgstr ""
414
 
415
- #: includes/discount-base.php:1056 view/view-cart-rules.php:186
416
  msgid "Cart Item Count"
417
  msgstr ""
418
 
419
- #: includes/discount-base.php:1057 view/view-cart-rules.php:189
420
  msgid "Number of line items in the cart (not quantity) at least"
421
  msgstr ""
422
 
423
- #: includes/discount-base.php:1058 view/view-cart-rules.php:193
424
  msgid "Number of line items in the cart (not quantity) less than"
425
  msgstr ""
426
 
427
- #: includes/discount-base.php:1059 view/view-cart-rules.php:196
428
  msgid "Quantity Sum"
429
  msgstr ""
430
 
431
- #: includes/discount-base.php:1060 view/view-cart-rules.php:202
432
  #: view/view-cart-rules.php:205
433
  msgid "Total number of quantities in the cart at least"
434
  msgstr ""
435
 
436
- #: includes/discount-base.php:1061 view/view-cart-rules.php:214
437
  #: view/view-cart-rules.php:217
438
  msgid "Total number of quantities in the cart less than"
439
  msgstr ""
440
 
441
- #: includes/discount-base.php:1062 view/view-cart-rules.php:246
442
  msgid "Categories in cart"
443
  msgstr ""
444
 
445
- #: includes/discount-base.php:1063 view/view-cart-rules.php:252
446
  msgid "Including sub-categories in cart"
447
  msgstr ""
448
 
449
- #: includes/discount-base.php:1064 view/view-cart-rules.php:261
450
  msgid "Customer Details (must be logged in)"
451
  msgstr ""
452
 
453
- #: includes/discount-base.php:1065 view/view-cart-rules.php:267
454
  #: view/view-cart-rules.php:269
455
  msgid "User in list"
456
  msgstr ""
457
 
458
- #: includes/discount-base.php:1066 view/view-cart-rules.php:277
459
  #: view/view-cart-rules.php:279
460
  msgid "User role in list"
461
  msgstr ""
462
 
463
- #: includes/discount-base.php:1067 view/view-cart-rules.php:287
464
- #: view/view-cart-rules.php:289
465
  msgid "Shipping country in list"
466
  msgstr ""
467
 
468
- #: includes/discount-base.php:1068 view/view-cart-rules.php:293
469
  msgid "Customer Email"
470
  msgstr ""
471
 
472
- #: includes/discount-base.php:1069
473
  msgid "Email with TLD (Ege: edu)"
474
  msgstr ""
475
 
476
- #: includes/discount-base.php:1070 view/view-cart-rules.php:309
477
- #: view/view-cart-rules.php:311
478
  msgid "Email with Domain (Eg: gmail.com)"
479
  msgstr ""
480
 
481
- #: includes/discount-base.php:1071 view/view-cart-rules.php:315
482
  msgid "Customer Billing Details"
483
  msgstr ""
484
 
485
- #: includes/discount-base.php:1072 view/view-cart-rules.php:321
486
- #: view/view-cart-rules.php:323
487
  msgid "Billing city"
488
  msgstr ""
489
 
490
- #: includes/discount-base.php:1073 view/view-cart-rules.php:327
491
  msgid "Customer Shipping Details"
492
  msgstr ""
493
 
494
- #: includes/discount-base.php:1074 view/view-cart-rules.php:333
495
  #: view/view-cart-rules.php:335
496
  msgid "Shipping state"
497
  msgstr ""
498
 
499
- #: includes/discount-base.php:1075 view/view-cart-rules.php:343
500
- #: view/view-cart-rules.php:345
501
  msgid "Shipping city"
502
  msgstr ""
503
 
504
- #: includes/discount-base.php:1076 view/view-cart-rules.php:353
505
  #: view/view-cart-rules.php:355
506
  msgid "Shipping zip code"
507
  msgstr ""
508
 
509
- #: includes/discount-base.php:1077 view/view-cart-rules.php:359
510
  #: view/view-pricing-rules.php:486
511
  msgid "Purchase History"
512
  msgstr ""
513
 
514
- #: includes/discount-base.php:1078 view/view-cart-rules.php:365
515
  #: view/view-cart-rules.php:367 view/view-pricing-rules.php:494
516
  msgid "Purchased amount"
517
  msgstr ""
518
 
519
- #: includes/discount-base.php:1079 view/view-cart-rules.php:375
520
  #: view/view-cart-rules.php:377 view/view-pricing-rules.php:495
521
  msgid "Number of previous orders made"
522
  msgstr ""
523
 
524
- #: includes/discount-base.php:1080 view/view-cart-rules.php:385
525
  #: view/view-cart-rules.php:387 view/view-pricing-rules.php:496
526
  msgid "Number of previous orders made with following products"
527
  msgstr ""
528
 
529
- #: includes/discount-base.php:1081 view/view-cart-rules.php:395
530
  #: view/view-cart-rules.php:397 view/view-pricing-rules.php:497
531
  msgid "Number of quantity(s) in previous orders made with following products"
532
  msgstr ""
533
 
534
- #: includes/discount-base.php:1082 view/view-cart-rules.php:401
535
  msgid "Coupon applied"
536
  msgstr ""
537
 
538
- #: includes/discount-base.php:1083 view/view-cart-rules.php:407
539
  #: view/view-cart-rules.php:409
540
  msgid "Atleast any one"
541
  msgstr ""
542
 
543
- #: includes/discount-base.php:1084 view/view-cart-rules.php:417
544
  #: view/view-cart-rules.php:419
545
  msgid "All selected"
546
  msgstr ""
547
 
548
- #: includes/discount-base.php:1085 view/view-cart-rules.php:618
549
  #: view/view-pricing-rules.php:534
550
  msgid "Greater than or equal to"
551
  msgstr ""
552
 
553
- #: includes/discount-base.php:1086 view/view-cart-rules.php:619
554
  #: view/view-pricing-rules.php:535 view/view-pricing-rules.php:594
555
  msgid "Less than or equal to"
556
  msgstr ""
557
 
558
- #: includes/discount-base.php:1087 view/view-cart-rules.php:621
559
  #: view/view-pricing-rules.php:538
560
  msgid "and the order status should be"
561
  msgstr ""
562
 
563
- #: includes/discount-base.php:1088 view/cart-rules.php:114
564
  #: view/cart-rules.php:209 view/pricing-rules.php:144
565
  #: view/pricing-rules.php:239 view/view-cart-rules.php:662
566
  msgid "Action"
567
  msgstr ""
568
 
569
- #: includes/discount-base.php:1089 view/settings.php:21
570
  #: view/settings_taxonomy.php:21
571
  msgid "Save"
572
  msgstr ""
573
 
574
- #: includes/discount-base.php:1090
575
  msgid "Saved Successfully!"
576
  msgstr ""
577
 
578
- #: includes/discount-base.php:1091 view/view-cart-rules.php:465
579
  #: view/view-cart-rules.php:533 view/view-cart-rules.php:553
580
  #: view/view-cart-rules.php:574 view/view-cart-rules.php:626
581
  #: view/view-pricing-rules.php:235 view/view-pricing-rules.php:251
582
  #: view/view-pricing-rules.php:546 view/view-pricing-rules.php:630
583
- #: view/view-pricing-rules.php:792
584
  msgid "None selected"
585
  msgstr ""
586
 
587
- #: includes/discount-base.php:1092 view/view-cart-rules.php:258
588
  msgid "In each category"
589
  msgstr ""
590
 
591
- #: includes/discount-base.php:1093 view/settings_price_rules.php:208
592
  #: view/settings_price_rules.php:226 view/settings_price_rules.php:244
593
  #: view/settings_price_rules.php:262
594
  msgid "Show"
595
  msgstr ""
596
 
597
- #: includes/discount-base.php:1094 view/template/sidebar.php:12
598
  msgid "Hide"
599
  msgstr ""
600
 
601
- #: includes/discount-base.php:1095
602
  msgid "Please select at least one rule"
603
  msgstr ""
604
 
605
- #: includes/discount-base.php:1096
606
  msgid "Please select an action to apply"
607
  msgstr ""
608
 
609
- #: includes/discount-base.php:1097
610
  msgid "Are you sure to remove the selected rules"
611
  msgstr ""
612
 
613
- #: includes/discount-base.php:1098 view/view-pricing-rules.php:781
614
  msgid "Choose product(s)"
615
  msgstr ""
616
 
617
- #: includes/discount-base.php:1099 view/view-pricing-rules.php:791
618
  msgid "Choose category(ies)"
619
  msgstr ""
620
 
621
- #: includes/discount-base.php:1100
622
  msgid "Search for a coupon"
623
  msgstr ""
624
 
625
- #: includes/discount-base.php:1101 view/view-pricing-rules.php:720
626
- #: view/view-pricing-rules.php:815
627
  #, php-format
628
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
629
  msgstr ""
630
 
631
- #: includes/discount-base.php:1102 view/view-pricing-rules.php:721
632
  #, php-format
633
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
634
  msgstr ""
635
 
636
- #: includes/discount-base.php:1103 view/view-pricing-rules.php:746
 
 
 
 
 
 
 
 
 
 
 
 
637
  msgid ""
638
  "Auto add all selected products - Automatically added to the cart <br> Same "
639
  "product - get discount in same product <br> Any one cheapest from selected - "
@@ -644,170 +660,263 @@ msgid ""
644
  "no.of quantities"
645
  msgstr ""
646
 
647
- #: includes/discount-base.php:1104 view/view-cart-rules.php:221
648
  msgid "Products"
649
  msgstr ""
650
 
651
- #: includes/discount-base.php:1105 view/view-cart-rules.php:226
652
  msgid "Products in cart"
653
  msgstr ""
654
 
655
- #: includes/discount-base.php:1106 view/view-cart-rules.php:232
656
  #: view/view-pricing-rules.php:270
657
  msgid "Exclude products"
658
  msgstr ""
659
 
660
- #: includes/discount-base.php:1107 view/view-cart-rules.php:238
661
  msgid "Exclude on sale products"
662
  msgstr ""
663
 
664
- #: includes/discount-base.php:1108 view/view-cart-rules.php:503
665
  msgid "This will exclude the on sale products from discount"
666
  msgstr ""
667
 
668
- #: includes/discount-base.php:1109 view/view-cart-rules.php:634
669
  #: view/view-pricing-rules.php:553
670
  msgid "From all previous orders"
671
  msgstr ""
672
 
673
- #: includes/discount-base.php:1110 view/view-cart-rules.php:635
674
  #: view/view-pricing-rules.php:554
675
  msgid "Last 7 days"
676
  msgstr ""
677
 
678
- #: includes/discount-base.php:1111 view/view-cart-rules.php:636
679
  #: view/view-pricing-rules.php:555
680
  msgid "Last 14 days"
681
  msgstr ""
682
 
683
- #: includes/discount-base.php:1112 view/view-cart-rules.php:637
684
  #: view/view-pricing-rules.php:556
685
  msgid "Last 30 days"
686
  msgstr ""
687
 
688
- #: includes/discount-base.php:1113 view/view-cart-rules.php:638
689
  #: view/view-pricing-rules.php:557
690
  msgid "Last 60 days"
691
  msgstr ""
692
 
693
- #: includes/discount-base.php:1114 view/view-cart-rules.php:639
694
  #: view/view-pricing-rules.php:558
695
  msgid "Last 90 days"
696
  msgstr ""
697
 
698
- #: includes/discount-base.php:1115 view/view-cart-rules.php:640
699
  #: view/view-pricing-rules.php:559
700
  msgid "Last 180 days"
701
  msgstr ""
702
 
703
- #: includes/discount-base.php:1116 view/view-cart-rules.php:641
704
  #: view/view-pricing-rules.php:560
705
  msgid "Last 1 year"
706
  msgstr ""
707
 
708
- #: includes/discount-base.php:1117 view/view-cart-rules.php:642
709
  #: view/view-pricing-rules.php:561
710
  msgid "Custom"
711
  msgstr ""
712
 
713
- #: includes/discount-base.php:1118 view/view-cart-rules.php:645
714
  #: view/view-pricing-rules.php:565
715
  msgid "in days"
716
  msgstr ""
717
 
718
- #: includes/discount-base.php:1196 view/includes/menu.php:13
 
 
 
 
 
 
 
 
 
 
719
  msgid "Settings"
720
  msgstr ""
721
 
722
- #: includes/pricing-rules.php:2881 view/view-pricing-rules.php:586
723
  msgid "Buy"
724
  msgstr ""
725
 
726
- #: includes/pricing-rules.php:2885
727
  msgid " less than or equal to "
728
  msgstr ""
729
 
730
- #: includes/pricing-rules.php:2885 includes/pricing-rules.php:2891
731
  msgid " Quantity"
732
  msgstr ""
733
 
734
- #: includes/pricing-rules.php:2888
735
  msgid " Quantity "
736
  msgstr ""
737
 
738
- #: includes/pricing-rules.php:2895
739
  msgid " or more Quantity"
740
  msgstr ""
741
 
742
- #: includes/pricing-rules.php:2904
743
  msgid " any "
744
  msgstr ""
745
 
746
- #: includes/pricing-rules.php:2904
747
  msgid " products from "
748
  msgstr ""
749
 
750
- #: includes/pricing-rules.php:2911
751
  msgid " in each products"
752
  msgstr ""
753
 
754
- #: includes/pricing-rules.php:2923
755
- msgid " and get discount in "
756
  msgstr ""
757
 
758
- #: includes/pricing-rules.php:2926
759
  msgid " first "
760
  msgstr ""
761
 
762
- #: includes/pricing-rules.php:2928 includes/pricing-rules.php:2932
763
  msgid " quantity of product(s) - "
764
  msgstr ""
765
 
766
- #: includes/pricing-rules.php:2930
767
  msgid " after first "
768
  msgstr ""
769
 
770
- #: includes/pricing-rules.php:2948
771
  msgid "Category(ies) "
772
  msgstr ""
773
 
774
- #: includes/pricing-rules.php:3016
775
  msgid "Get "
776
  msgstr ""
777
 
778
- #: includes/pricing-rules.php:3018
779
  #, php-format
780
  msgid "% discount in "
781
  msgstr ""
782
 
783
- #: includes/pricing-rules.php:3021
784
  msgid "same product"
785
  msgstr ""
786
 
787
- #: includes/pricing-rules.php:3023
788
  msgid "any cheapest one from cart"
789
  msgstr ""
790
 
791
- #: includes/pricing-rules.php:3026
792
  msgid "any cheapest one of "
793
  msgstr ""
794
 
795
- #: includes/pricing-rules.php:3031
796
  msgid " quantity of any "
797
  msgstr ""
798
 
799
- #: includes/pricing-rules.php:3033
800
  msgid " cheapest item "
801
  msgstr ""
802
 
803
- #: includes/pricing-rules.php:3036
804
  msgid " quantity of cheapest item "
805
  msgstr ""
806
 
807
- #: includes/pricing-rules.php:3040
808
  msgid "from the category "
809
  msgstr ""
810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
  #: view/cart-rules.php:48
812
  msgid "Cart Rules"
813
  msgstr ""
@@ -1498,6 +1607,63 @@ msgstr ""
1498
  msgid "Looking for more features? Upgrade to PRO"
1499
  msgstr ""
1500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1501
  #: view/view-cart-rules.php:56 view/view-pricing-rules.php:38
1502
  msgid "Close and go back to list"
1503
  msgstr ""
@@ -1580,12 +1746,12 @@ msgstr ""
1580
  msgid "Categories In Cart"
1581
  msgstr ""
1582
 
1583
- #: view/view-cart-rules.php:299 view/view-cart-rules.php:301
1584
  msgid "Email with TLD (Eg: edu)"
1585
  msgstr ""
1586
 
1587
  #: view/view-cart-rules.php:673 view/view-cart-rules.php:770
1588
- #: view/view-pricing-rules.php:644 view/view-pricing-rules.php:849
1589
  msgid "Previous"
1590
  msgstr ""
1591
 
@@ -1821,11 +1987,6 @@ msgstr ""
1821
  msgid "Equal"
1822
  msgstr ""
1823
 
1824
- #: view/view-pricing-rules.php:598 view/view-pricing-rules.php:601
1825
- #: view/view-pricing-rules.php:621
1826
- msgid "Quantity"
1827
- msgstr ""
1828
-
1829
  #: view/view-pricing-rules.php:600
1830
  msgid "to"
1831
  msgstr ""
@@ -1843,7 +2004,7 @@ msgid "Apply discount in category(ies)"
1843
  msgstr ""
1844
 
1845
  #: view/view-pricing-rules.php:615
1846
- msgid "and get discount in "
1847
  msgstr ""
1848
 
1849
  #: view/view-pricing-rules.php:618
@@ -1870,14 +2031,41 @@ msgstr ""
1870
  msgid "Add New Range"
1871
  msgstr ""
1872
 
1873
- #: view/view-pricing-rules.php:832
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1874
  msgid "Guide to create perfect BOGO rules"
1875
  msgstr ""
1876
 
1877
- #: view/view-pricing-rules.php:842
1878
  msgid "Percent"
1879
  msgstr ""
1880
 
1881
- #: view/view-pricing-rules.php:843
1882
  msgid "Fixed"
1883
  msgstr ""
39
  msgid "Your server current date and time: "
40
  msgstr ""
41
 
42
+ #: helper/general-helper.php:768
43
  msgid "Read Docs"
44
  msgstr ""
45
 
125
  msgstr ""
126
 
127
  #: includes/advanced/free_shipping_method.php:73
128
+ #: includes/discount-base.php:1050 view/cart-rules.php:133
129
  #: view/pricing-rules.php:163 view/settings_promotion.php:65
130
  #: view/settings_promotion.php:100
131
  msgid "Enable"
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
 
246
+ #: includes/discount-base.php:1015
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
 
274
+ #: includes/discount-base.php:1021
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
 
353
+ #: includes/discount-base.php:1040
354
  msgid "Search for a products"
355
  msgstr ""
356
 
357
+ #: includes/discount-base.php:1041
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
 
369
+ #: includes/discount-base.php:1044
370
  msgid "Percentage"
371
  msgstr ""
372
 
373
+ #: includes/discount-base.php:1045
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
 
387
+ #: includes/discount-base.php:1048
388
  msgid "none"
389
  msgstr ""
390
 
391
+ #: includes/discount-base.php:1049
392
  msgid "Are you sure to remove this ?"
393
  msgstr ""
394
 
395
+ #: includes/discount-base.php:1051 view/cart-rules.php:130
396
  #: view/pricing-rules.php:160
397
  msgid "Disable"
398
  msgstr ""
399
 
400
+ #: includes/discount-base.php:1052
401
  msgid "Are you sure to remove ?"
402
  msgstr ""
403
 
404
+ #: includes/discount-base.php:1053 view/view-cart-rules.php:172
405
  msgid "Type"
406
  msgstr ""
407
 
408
+ #: includes/discount-base.php:1054 view/view-cart-rules.php:176
409
  msgid "Cart Subtotal"
410
  msgstr ""
411
 
412
+ #: includes/discount-base.php:1055 view/view-cart-rules.php:179
413
  msgid "Subtotal at least"
414
  msgstr ""
415
 
416
+ #: includes/discount-base.php:1056 view/view-cart-rules.php:183
417
  msgid "Subtotal less than"
418
  msgstr ""
419
 
420
+ #: includes/discount-base.php:1057 view/view-cart-rules.php:186
421
  msgid "Cart Item Count"
422
  msgstr ""
423
 
424
+ #: includes/discount-base.php:1058 view/view-cart-rules.php:189
425
  msgid "Number of line items in the cart (not quantity) at least"
426
  msgstr ""
427
 
428
+ #: includes/discount-base.php:1059 view/view-cart-rules.php:193
429
  msgid "Number of line items in the cart (not quantity) less than"
430
  msgstr ""
431
 
432
+ #: includes/discount-base.php:1060 view/view-cart-rules.php:196
433
  msgid "Quantity Sum"
434
  msgstr ""
435
 
436
+ #: includes/discount-base.php:1061 view/view-cart-rules.php:202
437
  #: view/view-cart-rules.php:205
438
  msgid "Total number of quantities in the cart at least"
439
  msgstr ""
440
 
441
+ #: includes/discount-base.php:1062 view/view-cart-rules.php:214
442
  #: view/view-cart-rules.php:217
443
  msgid "Total number of quantities in the cart less than"
444
  msgstr ""
445
 
446
+ #: includes/discount-base.php:1063 view/view-cart-rules.php:246
447
  msgid "Categories in cart"
448
  msgstr ""
449
 
450
+ #: includes/discount-base.php:1064 view/view-cart-rules.php:252
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
 
477
+ #: includes/discount-base.php:1070
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
  "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 ""
846
+
847
+ #: includes/survey.php:82
848
+ msgid "Please select an option"
849
+ msgstr ""
850
+
851
+ #: includes/survey.php:85
852
+ msgid "Sending Feedback"
853
+ msgstr ""
854
+
855
+ #: includes/survey.php:239
856
+ msgid "I am switching to a different discount plugin."
857
+ msgstr ""
858
+
859
+ #: includes/survey.php:243
860
+ msgid "I could not get my discount rule to work."
861
+ msgstr ""
862
+
863
+ #: includes/survey.php:247
864
+ msgid "It does not meet my discount requirements."
865
+ msgstr ""
866
+
867
+ #: includes/survey.php:251
868
+ msgid "Plugin is complex."
869
+ msgstr ""
870
+
871
+ #: includes/survey.php:255
872
+ msgid "I'm trying to troubleshoot the plugin."
873
+ msgstr ""
874
+
875
+ #: includes/survey.php:259
876
+ msgid "I was instructed to deactivate by Flycart Support."
877
+ msgstr ""
878
+
879
+ #: includes/survey.php:263
880
+ msgid "I no longer use this plugin."
881
+ msgstr ""
882
+
883
+ #: includes/survey.php:267
884
+ msgid "It's a temporary deactivation."
885
+ msgstr ""
886
+
887
+ #: includes/survey.php:271
888
+ msgid "Other"
889
+ msgstr ""
890
+
891
+ #: includes/survey.php:273
892
+ msgid "Please share the reason"
893
+ msgstr ""
894
+
895
+ #: includes/survey.php:283
896
+ msgid "Quick Feedback"
897
+ msgstr ""
898
+
899
+ #: includes/survey.php:284
900
+ msgid "Close"
901
+ msgstr ""
902
+
903
+ #: includes/survey.php:292
904
+ #, php-format
905
+ msgid "If you have a moment, please share why you are deactivating %s:"
906
+ msgstr ""
907
+
908
+ #: includes/survey.php:293
909
+ msgid "Discount Rules for WooCommerce"
910
+ msgstr ""
911
+
912
+ #: includes/survey.php:321
913
+ msgid "Submit & Deactivate"
914
+ msgstr ""
915
+
916
+ #: includes/survey.php:323
917
+ msgid "Skip & Deactivate"
918
+ msgstr ""
919
+
920
  #: view/cart-rules.php:48
921
  msgid "Cart Rules"
922
  msgstr ""
1607
  msgid "Looking for more features? Upgrade to PRO"
1608
  msgstr ""
1609
 
1610
+ #: view/template/sidebar.php:19
1611
+ msgid "With PRO version, you can create:"
1612
+ msgstr ""
1613
+
1614
+ #: view/template/sidebar.php:20
1615
+ msgid "- Categories based discounts"
1616
+ msgstr ""
1617
+
1618
+ #: view/template/sidebar.php:21
1619
+ msgid "- User roles based discounts"
1620
+ msgstr ""
1621
+
1622
+ #: view/template/sidebar.php:22
1623
+ msgid "- Buy One Get One Free deals"
1624
+ msgstr ""
1625
+
1626
+ #: view/template/sidebar.php:23
1627
+ msgid "- Buy X Get Y deals"
1628
+ msgstr ""
1629
+
1630
+ #: view/template/sidebar.php:24
1631
+ #, php-format
1632
+ msgid "- Buy 2, get 1 at 50% discount"
1633
+ msgstr ""
1634
+
1635
+ #: view/template/sidebar.php:25
1636
+ msgid "- Buy 3 for $10 (Package / Bundle [Set] Discount)"
1637
+ msgstr ""
1638
+
1639
+ #: view/template/sidebar.php:26
1640
+ msgid "- Different discounts with one coupon code"
1641
+ msgstr ""
1642
+
1643
+ #: view/template/sidebar.php:27
1644
+ msgid "- Purchase history based discounts"
1645
+ msgstr ""
1646
+
1647
+ #: view/template/sidebar.php:28
1648
+ msgid "- Free product / gift"
1649
+ msgstr ""
1650
+
1651
+ #: view/template/sidebar.php:29
1652
+ msgid "- Discount for variants"
1653
+ msgstr ""
1654
+
1655
+ #: view/template/sidebar.php:30
1656
+ msgid "- Conditional discounts"
1657
+ msgstr ""
1658
+
1659
+ #: view/template/sidebar.php:31
1660
+ msgid "- Fixed cost discounts"
1661
+ msgstr ""
1662
+
1663
+ #: view/template/sidebar.php:32
1664
+ msgid "- Offer fixed price on certain conditions"
1665
+ msgstr ""
1666
+
1667
  #: view/view-cart-rules.php:56 view/view-pricing-rules.php:38
1668
  msgid "Close and go back to list"
1669
  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
 
1987
  msgid "Equal"
1988
  msgstr ""
1989
 
 
 
 
 
 
1990
  #: view/view-pricing-rules.php:600
1991
  msgid "to"
1992
  msgstr ""
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
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:</"
2045
+ "b> You will need to enter the entire package / bundle cost. Example: 10 (for "
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 "
2057
+ "quantities of Product A. The price per unit will reduce to $15<br><b>NOTE:</"
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 ""
includes/discount-base.php CHANGED
@@ -1008,6 +1008,7 @@ if (!class_exists('FlycartWooDiscountBase')) {
1008
  'please_enter_a_key' => esc_html__('Please enter a Key', 'woo-discount-rules'),
1009
  'min_quantity' => esc_html__('Min Quantity', 'woo-discount-rules'),
1010
  'max_quantity' => esc_html__('Max Quantity', 'woo-discount-rules'),
 
1011
  'place_holder_ex_1' => esc_html__('ex. 1', 'woo-discount-rules'),
1012
  'place_holder_ex_10' => esc_html__('ex. 10', 'woo-discount-rules'),
1013
  'place_holder_ex_50' => esc_html__('ex. 50', 'woo-discount-rules'),
@@ -1100,6 +1101,8 @@ if (!class_exists('FlycartWooDiscountBase')) {
1100
  'coupon_select_box_placeholder' => esc_html__('Search for a coupon', 'woo-discount-rules'),
1101
  'percentage_discount_amount_tool_tip_text' => esc_attr__('Enter only numeric values. Eg: <b>50</b> for 50% discount', 'woo-discount-rules'),
1102
  'price_discount_amount_tool_tip_text' => sprintf(esc_attr__('Enter the discount price. Eg: <b>10</b> for %s discount', 'woo-discount-rules'), strip_tags(FlycartWoocommerceProduct::wc_price(10))),
 
 
1103
  'discount_product_option_tooltip' => esc_html__("Auto add all selected products - Automatically added to the cart <br> Same product - get discount in same product <br> Any one cheapest from selected - Get discount in one selected product <br> Any one cheapest from all products - Get discount in one cheapest product in cart <br> Cheapest in cart - selected category(ies) - cheapest product from the selected category will be discounted <br> Cheapest in cart - selected item(s) - get discount in chosen no.of quantities", 'woo-discount-rules'),
1104
  'products_in_cart' => esc_html__('Products', 'woo-discount-rules'),
1105
  'products_in_list' => esc_html__('Products in cart', 'woo-discount-rules'),
@@ -1116,6 +1119,8 @@ if (!class_exists('FlycartWooDiscountBase')) {
1116
  'last_1_year' => esc_html__('Last 1 year', 'woo-discount-rules'),
1117
  'custom_days' => esc_html__('Custom', 'woo-discount-rules'),
1118
  'in_days' => esc_html__('in days', 'woo-discount-rules'),
 
 
1119
  );
1120
  }
1121
 
1008
  'please_enter_a_key' => esc_html__('Please enter a Key', 'woo-discount-rules'),
1009
  'min_quantity' => esc_html__('Min Quantity', 'woo-discount-rules'),
1010
  'max_quantity' => esc_html__('Max Quantity', 'woo-discount-rules'),
1011
+ 'set_quantity' => esc_html__('Quantity', 'woo-discount-rules'),
1012
  'place_holder_ex_1' => esc_html__('ex. 1', 'woo-discount-rules'),
1013
  'place_holder_ex_10' => esc_html__('ex. 10', 'woo-discount-rules'),
1014
  'place_holder_ex_50' => esc_html__('ex. 50', 'woo-discount-rules'),
1101
  'coupon_select_box_placeholder' => esc_html__('Search for a coupon', 'woo-discount-rules'),
1102
  'percentage_discount_amount_tool_tip_text' => esc_attr__('Enter only numeric values. Eg: <b>50</b> for 50% discount', 'woo-discount-rules'),
1103
  'price_discount_amount_tool_tip_text' => sprintf(esc_attr__('Enter the discount price. Eg: <b>10</b> for %s discount', 'woo-discount-rules'), strip_tags(FlycartWoocommerceProduct::wc_price(10))),
1104
+ 'fixed_price_discount_amount_tool_tip_text' => sprintf(esc_attr__('Enter the discounted price per unit. Eg: <b>10</b> for %s as unit price', 'woo-discount-rules'), strip_tags(FlycartWoocommerceProduct::wc_price(10))),
1105
+ 'set_discount_amount_tool_tip_text' => sprintf(esc_attr__('Enter the price for selected quantity. Eg: <b>10</b> then %s as total price for selected quantity', 'woo-discount-rules'), strip_tags(FlycartWoocommerceProduct::wc_price(10))),
1106
  'discount_product_option_tooltip' => esc_html__("Auto add all selected products - Automatically added to the cart <br> Same product - get discount in same product <br> Any one cheapest from selected - Get discount in one selected product <br> Any one cheapest from all products - Get discount in one cheapest product in cart <br> Cheapest in cart - selected category(ies) - cheapest product from the selected category will be discounted <br> Cheapest in cart - selected item(s) - get discount in chosen no.of quantities", 'woo-discount-rules'),
1107
  'products_in_cart' => esc_html__('Products', 'woo-discount-rules'),
1108
  'products_in_list' => esc_html__('Products in cart', 'woo-discount-rules'),
1119
  'last_1_year' => esc_html__('Last 1 year', 'woo-discount-rules'),
1120
  'custom_days' => esc_html__('Custom', 'woo-discount-rules'),
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
 
includes/pricing-rules.php CHANGED
@@ -1318,7 +1318,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1318
  if($bogo) $quantity = $this->getProductQuantityForCumulativeSpecificProducts($item, 0, $rule, $rule['type']['specific_products']);
1319
  else $quantity = $this->getProductQuantityForCumulativeSpecificProducts($item, $product_page, $rule, $rule['type']['specific_products']);
1320
  }
1321
- $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo);
1322
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1323
  }
1324
  break;
@@ -1359,7 +1359,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1359
  }
1360
  }
1361
  if(!$alreadyExists){
1362
- $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo, $rule['product_to_exclude']);
1363
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1364
  }
1365
  }
@@ -1400,7 +1400,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1400
  }
1401
  }
1402
  if(!$alreadyExists){
1403
- $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo, $rule['product_to_exclude']);
1404
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1405
  }
1406
  }
@@ -1414,7 +1414,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1414
  if($bogo) $quantity = $this->getProductQuantityForCumulativeProducts($item, 0, $rule);
1415
  else $quantity = $this->getProductQuantityForCumulativeProducts($item, $product_page, $rule);
1416
  }
1417
- $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $product_page, $bogo, $rule['product_to_exclude']);
1418
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1419
  }
1420
 
@@ -1831,7 +1831,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1831
  * @param $product_page
1832
  * @return array|bool
1833
  */
1834
- public function getAdjustmentAmount($item, $quantity, $discount_ranges, $product_page, $bogo, $product_to_exclude = array())
1835
  {
1836
  $adjustment = array();
1837
  if(FlycartWooDiscountRulesGeneralHelper::is_countable($discount_ranges)){
@@ -1840,6 +1840,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1840
  $quantity += ($this->custom_qty-1);
1841
  }
1842
  }
 
 
1843
  foreach($discount_ranges as $discount_range) {
1844
  if (!is_array($discount_range) && !is_object($discount_range)) return false;
1845
  $range = is_array($discount_range) ? (object) $discount_range : $discount_range;
@@ -1851,91 +1853,254 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1851
 
1852
  if ($max == false) continue;
1853
 
1854
- if ((int)$min <= (int)$quantity && (int)$max >= (int)$quantity) {
1855
- if($type == 'product_discount'){
1856
- $discount_product_option = isset($range->discount_product_option) ? $range->discount_product_option : 'all';
1857
- $productIds = isset($range->discount_product) ? $range->discount_product : array();
1858
- $productIds = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($productIds);
1859
- if($discount_product_option == 'more_than_one_cheapest' || $discount_product_option == 'any_cheapest'){
1860
- $variants = null;
1861
- if(isset($range->discount_product_variants)) $variants = $range->discount_product_variants;
1862
- $productIds = apply_filters('woo_discount_rule_products_to_include', $productIds, $discount_ranges, $variants);
1863
  }
1864
- if($discount_product_option == 'same_product'){
1865
- $productId = FlycartWoocommerceProduct::get_id($item['data']);
1866
- $discount_quantity = isset($range->discount_bogo_qty)? $range->discount_bogo_qty: 1000;
1867
- $productCheapest = $this->getCheapestProductFromCart(array($productId), 0, $discount_quantity, $range, $product_to_exclude);
1868
- if(!empty($productCheapest)){
1869
- $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']), 'product_cart_item_keys' => array($productCheapest['product_cart_item_key']), 'product_discount_details' => $productCheapest['discount_details']) ;
1870
- }
1871
- } else if($discount_product_option == 'any_cheapest_from_all'){
1872
- $productCheapest = $this->getCheapestProductFromCart($productIds, 1, 1, $range, $product_to_exclude);
1873
- if(!empty($productCheapest)){
1874
- $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']), 'product_cart_item_keys' => array($productCheapest['product_cart_item_key']), 'product_discount_details' => $productCheapest['discount_details']) ;
1875
- }
1876
- } else if($discount_product_option == 'any_cheapest'){
1877
- $productCheapest = $this->getCheapestProductFromCart($productIds,0, 1, $range, $product_to_exclude);
1878
- if(!empty($productCheapest)){
1879
- $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']), 'product_cart_item_keys' => array($productCheapest['product_cart_item_key']), 'product_discount_details' => $productCheapest['discount_details']) ;
1880
- }
1881
- } else if($discount_product_option == 'more_than_one_cheapest' || $discount_product_option == 'more_than_one_cheapest_from_all'|| $discount_product_option == 'more_than_one_cheapest_from_cat'){
1882
- $discount_product_items = (isset($range->discount_product_items) ? $range->discount_product_items : 1);
1883
- if($discount_product_items < 1) $discount_product_items = 1;
1884
- $discount_product_qty = (isset($range->discount_product_qty) ? $range->discount_product_qty : 1);
1885
- if($discount_product_qty < 1) $discount_product_qty = 1;
1886
- $productCheapest = $this->getMoreThanOneCheapestProductFromCart($productIds, $discount_product_qty, $discount_product_items, $range, $product_to_exclude);
1887
- if(!empty($productCheapest)){
1888
- $adjustment = $productCheapest ;
1889
  }
1890
- } else {
1891
- //To handle BOGO
1892
- if(is_array($productIds) && count($productIds)){
1893
- $bogo_count = isset($range->discount_bogo_qty)? (int)$range->discount_bogo_qty: 1;
1894
- if($bogo_count < 1) $bogo_count = 1;
1895
- if($bogo){
1896
- $free_product = $this->bogo_matches;
1897
- foreach ($productIds as $productId){
1898
-
1899
- if(isset($free_product[$productId])){
1900
- $free_product[$productId]['count'] = $free_product[$productId]['count']+$bogo_count;
1901
- } else {
1902
- $free_product[$productId]['count'] = $bogo_count;
1903
- $free_product[$productId]['rule_name'] = $range->title;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1904
  }
1905
- }
1906
- $this->bogo_matches = $free_product;
1907
- $adjustment[$type] = $productIds;
1908
- } else {
1909
- $range->discount_product_item_type = 'static';
1910
- $productCheapest = $this->getMoreThanOneCheapestProductFromCart($productIds, $bogo_count, count($productIds), $range, $product_to_exclude);
1911
- if (!empty($productCheapest)) {
1912
- $adjustment = $productCheapest;
1913
  }
1914
  }
1915
- }
1916
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1917
  }
1918
- } else {
1919
- $adjustment[$type] = (isset($range->to_discount) ? $range->to_discount : 0);
1920
- $product_discount_details = array();
1921
- if($type == 'percentage_discount'){
1922
- $product_discount_details['discount_type'] = 'percent';
1923
- $productPrice = FlycartWoocommerceProduct::get_price($item['data']);
1924
- $discount_price = $productPrice * ($range->to_discount / 100);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1925
  } else {
1926
- $product_discount_details['discount_type'] = 'price_discount';
1927
- $discount_price = $range->to_discount;
1928
  }
1929
- $product_discount_details['discount_value'] = $range->to_discount;
1930
- $product_discount_details['discount_quantity'] = $quantity;
1931
- $product_discount_details['discount_price'] = $discount_price;
1932
- $adjustment['product_discount_details'] = $product_discount_details;
 
 
 
 
 
 
 
 
1933
  }
1934
  }
1935
  }
1936
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1937
 
1938
- return $adjustment;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1939
  }
1940
 
1941
  /**
@@ -2920,7 +3085,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2920
  }
2921
  $condition .= ' '.trim($htmlProduct, ', ').' ';
2922
  }
2923
- $condition .= esc_html__(' and get discount in ', 'woo-discount-rules');
2924
  if($get_discount_type == 'product'){
2925
  if($product_to_apply_count_option == 'apply_first'){
2926
  $condition .= esc_html__(' first ', 'woo-discount-rules');
@@ -3011,6 +3176,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3011
  if (isset($base_config['show_discount_title_table'])) {
3012
  }
3013
  $condition = $min .' - ' . $max;
 
 
 
3014
  if ($discount_type == 'product_discount') {
3015
  $htmlProduct = '';
3016
  $htmlProduct .= esc_html__('Get ', 'woo-discount-rules');
@@ -3058,6 +3226,10 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3058
  $discount = trim($htmlProduct, '<br>');
3059
  } else if ($discount_type == 'percentage_discount') {
3060
  $discount = $to_discount.' %';
 
 
 
 
3061
  } else {
3062
  $discount = FlycartWoocommerceProduct::wc_price($to_discount);
3063
  }
@@ -3238,8 +3410,13 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3238
  return $discount;
3239
  }
3240
  $details = $rule_data = array();
 
3241
  foreach ($sets as $id => $set) {
3242
  // For the First price, it will return the amount after get hit.
 
 
 
 
3243
  if ($by == 'first') {
3244
  if(empty($set['amount'])){
3245
  continue;
@@ -3255,6 +3432,19 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3255
  }
3256
  }
3257
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
3258
  }
3259
  $discount = apply_filters('woo_discount_rules_discount_amount_before_apply', $discount, $set, $price, $product_page, $product);
3260
  if(isset($set['rule_order'])){
@@ -3265,7 +3455,6 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3265
  $details[] = isset($set['amount']['product_discount_details'])? $set['amount']['product_discount_details'] : array();
3266
  return array('amount' => $discount, 'details' => $details, 'rule' => $rule_data);
3267
  } else {
3268
- $has_discount = 0;
3269
  // For All, All rules going to apply.
3270
  if (isset($set['amount']['percentage_discount'])) {
3271
  $discount = ($price / 100) * $set['amount']['percentage_discount'];
@@ -3286,6 +3475,23 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3286
  // Append all Discounts.
3287
  $overall_discount = $overall_discount + $discount;
3288
  $has_discount = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3289
  }
3290
  if(isset($set['rule_order']) && $has_discount){
3291
  $rule_data[$set['rule_order']] = $set['item'];
@@ -3310,11 +3516,28 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3310
  $details = $rule_data = array();
3311
  if(is_array($discount_list) && count($discount_list)){
3312
  foreach ($discount_list as $id => $discount_item) {
3313
- $amount_type = (isset($discount_item['amount']['percentage_discount']) ? 'percentage_discount' : 'price_discount');
 
 
 
3314
  if ($amount_type == 'percentage_discount') {
3315
  if (isset($discount_item['amount']['percentage_discount'])) {
3316
  $amount = (($price / 100) * $discount_item['amount']['percentage_discount']);
3317
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3318
  } else {
3319
  if (isset($discount_item['amount']['price_discount'])) {
3320
  $amount = $discount_item['amount']['price_discount'];
@@ -3397,7 +3620,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3397
  'log' => $log,
3398
  'additional_details' => $additionalDetails,
3399
  );
3400
-
3401
  global $WOOCS;
3402
  if(isset($WOOCS)){
3403
  if (method_exists($WOOCS, 'get_currencies')){
@@ -3408,6 +3631,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3408
  //woocs_is_geoip_manipulation //woocs_is_fixed_enabled
3409
  if($is_geoip_manipulation || $woocs_is_fixed_enabled || $woocs_convert_value_based_on_currency){
3410
  $amount = $amount / $currencies[$WOOCS->current_currency]['rate'];
 
 
3411
  }
3412
  }
3413
  }
@@ -3415,9 +3640,15 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3415
  $amount_excluding_tax = FlycartWoocommerceProduct::get_price_excluding_tax($original_product, 1, $amount);
3416
  //for future reference
3417
  $discount_amount = $original_price - $amount;
 
 
 
3418
  $discount_amount = get_option('woocommerce_tax_display_cart') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($original_product, 1, $discount_amount) : FlycartWoocommerceProduct::get_price_including_tax($original_product, 1, $discount_amount);
3419
 
3420
  $discount_amount_excluding_tax = $original_price_excluding_tax - $amount_excluding_tax;
 
 
 
3421
  $woocommerce->cart->cart_contents[$item]['woo_discount']['discounted_price_per_product'] = $amount;
3422
  $woocommerce->cart->cart_contents[$item]['woo_discount']['discounted_price_total'] = $amount * $woocommerce->cart->cart_contents[$item]['quantity'];
3423
  $woocommerce->cart->cart_contents[$item]['woo_discount']['discount_amount'] = $discount_amount;
1318
  if($bogo) $quantity = $this->getProductQuantityForCumulativeSpecificProducts($item, 0, $rule, $rule['type']['specific_products']);
1319
  else $quantity = $this->getProductQuantityForCumulativeSpecificProducts($item, $product_page, $rule, $rule['type']['specific_products']);
1320
  }
1321
+ $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $rule, $product_page, $bogo);
1322
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1323
  }
1324
  break;
1359
  }
1360
  }
1361
  if(!$alreadyExists){
1362
+ $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $rule, $product_page, $bogo, $rule['product_to_exclude']);
1363
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1364
  }
1365
  }
1400
  }
1401
  }
1402
  if(!$alreadyExists){
1403
+ $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $rule, $product_page, $bogo, $rule['product_to_exclude']);
1404
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1405
  }
1406
  }
1414
  if($bogo) $quantity = $this->getProductQuantityForCumulativeProducts($item, 0, $rule);
1415
  else $quantity = $this->getProductQuantityForCumulativeProducts($item, $product_page, $rule);
1416
  }
1417
+ $discount_amount = $this->getAdjustmentAmount($item, $quantity, $this->array_first($rule['discount']), $rule, $product_page, $bogo, $rule['product_to_exclude']);
1418
  $applied_rules[$i] = $this->formatRulesToApply($discount_amount, $rule['name'], $index, $item['product_id'], $id);
1419
  }
1420
 
1831
  * @param $product_page
1832
  * @return array|bool
1833
  */
1834
+ public function getAdjustmentAmount($item, $quantity, $discount_ranges, $rule, $product_page, $bogo, $product_to_exclude = array())
1835
  {
1836
  $adjustment = array();
1837
  if(FlycartWooDiscountRulesGeneralHelper::is_countable($discount_ranges)){
1840
  $quantity += ($this->custom_qty-1);
1841
  }
1842
  }
1843
+ $has_set_discount = $set_discount_min_qty = 0;
1844
+ $set_discount_range = '';
1845
  foreach($discount_ranges as $discount_range) {
1846
  if (!is_array($discount_range) && !is_object($discount_range)) return false;
1847
  $range = is_array($discount_range) ? (object) $discount_range : $discount_range;
1853
 
1854
  if ($max == false) continue;
1855
 
1856
+ if($type == 'set_discount'){
1857
+ if((int)$min > $set_discount_min_qty){
1858
+ if ((int)$min <= (int)$quantity) {
1859
+ $set_discount_min_qty = (int)$min;
1860
+ $has_set_discount = true;
1861
+ $set_discount_range = $range;
 
 
 
1862
  }
1863
+ }
1864
+ } else {
1865
+ if ((int)$min <= (int)$quantity && (int)$max >= (int)$quantity) {
1866
+ if($type == 'product_discount'){
1867
+ $discount_product_option = isset($range->discount_product_option) ? $range->discount_product_option : 'all';
1868
+ $productIds = isset($range->discount_product) ? $range->discount_product : array();
1869
+ $productIds = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($productIds);
1870
+ if($discount_product_option == 'more_than_one_cheapest' || $discount_product_option == 'any_cheapest'){
1871
+ $variants = null;
1872
+ if(isset($range->discount_product_variants)) $variants = $range->discount_product_variants;
1873
+ $productIds = apply_filters('woo_discount_rule_products_to_include', $productIds, $discount_ranges, $variants);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1874
  }
1875
+ if($discount_product_option == 'same_product'){
1876
+ $productId = FlycartWoocommerceProduct::get_id($item['data']);
1877
+ $discount_quantity = isset($range->discount_bogo_qty)? $range->discount_bogo_qty: 1000;
1878
+ $productCheapest = $this->getCheapestProductFromCart(array($productId), 0, $discount_quantity, $range, $product_to_exclude);
1879
+ if(!empty($productCheapest)){
1880
+ $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']), 'product_cart_item_keys' => array($productCheapest['product_cart_item_key']), 'product_discount_details' => $productCheapest['discount_details']) ;
1881
+ }
1882
+ } else if($discount_product_option == 'any_cheapest_from_all'){
1883
+ $productCheapest = $this->getCheapestProductFromCart($productIds, 1, 1, $range, $product_to_exclude);
1884
+ if(!empty($productCheapest)){
1885
+ $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']), 'product_cart_item_keys' => array($productCheapest['product_cart_item_key']), 'product_discount_details' => $productCheapest['discount_details']) ;
1886
+ }
1887
+ } else if($discount_product_option == 'any_cheapest'){
1888
+ $productCheapest = $this->getCheapestProductFromCart($productIds,0, 1, $range, $product_to_exclude);
1889
+ if(!empty($productCheapest)){
1890
+ $adjustment = array ( 'price_discount' => $productCheapest['percent'], 'product_ids' => array($productCheapest['product']), 'product_cart_item_keys' => array($productCheapest['product_cart_item_key']), 'product_discount_details' => $productCheapest['discount_details']) ;
1891
+ }
1892
+ } else if($discount_product_option == 'more_than_one_cheapest' || $discount_product_option == 'more_than_one_cheapest_from_all'|| $discount_product_option == 'more_than_one_cheapest_from_cat'){
1893
+ $discount_product_items = (isset($range->discount_product_items) ? $range->discount_product_items : 1);
1894
+ if($discount_product_items < 1) $discount_product_items = 1;
1895
+ $discount_product_qty = (isset($range->discount_product_qty) ? $range->discount_product_qty : 1);
1896
+ if($discount_product_qty < 1) $discount_product_qty = 1;
1897
+ $productCheapest = $this->getMoreThanOneCheapestProductFromCart($productIds, $discount_product_qty, $discount_product_items, $range, $product_to_exclude);
1898
+ if(!empty($productCheapest)){
1899
+ $adjustment = $productCheapest ;
1900
+ }
1901
+ } else {
1902
+ //To handle BOGO
1903
+ if(is_array($productIds) && count($productIds)){
1904
+ $bogo_count = isset($range->discount_bogo_qty)? (int)$range->discount_bogo_qty: 1;
1905
+ if($bogo_count < 1) $bogo_count = 1;
1906
+ if($bogo){
1907
+ $free_product = $this->bogo_matches;
1908
+ foreach ($productIds as $productId){
1909
+
1910
+ if(isset($free_product[$productId])){
1911
+ $free_product[$productId]['count'] = $free_product[$productId]['count']+$bogo_count;
1912
+ } else {
1913
+ $free_product[$productId]['count'] = $bogo_count;
1914
+ $free_product[$productId]['rule_name'] = $range->title;
1915
+ }
1916
+ }
1917
+ $this->bogo_matches = $free_product;
1918
+ $adjustment[$type] = $productIds;
1919
+ } else {
1920
+ $range->discount_product_item_type = 'static';
1921
+ $productCheapest = $this->getMoreThanOneCheapestProductFromCart($productIds, $bogo_count, count($productIds), $range, $product_to_exclude);
1922
+ if (!empty($productCheapest)) {
1923
+ $adjustment = $productCheapest;
1924
  }
 
 
 
 
 
 
 
 
1925
  }
1926
  }
 
1927
 
1928
+ }
1929
+ } else {
1930
+ $adjustment[$type] = (isset($range->to_discount) ? $range->to_discount : 0);
1931
+ $product_discount_details = array();
1932
+ if($type == 'percentage_discount'){
1933
+ $product_discount_details['discount_type'] = 'percent';
1934
+ $productPrice = FlycartWoocommerceProduct::get_price($item['data']);
1935
+ $discount_price = $productPrice * ($range->to_discount / 100);
1936
+ } else if($type == 'fixed_price'){
1937
+ $product_discount_details['discount_type'] = 'fixed_price';
1938
+ $discount_price = $range->to_discount;
1939
+ } else {
1940
+ $product_discount_details['discount_type'] = 'price_discount';
1941
+ $discount_price = $range->to_discount;
1942
+ }
1943
+ $product_discount_details['discount_value'] = $range->to_discount;
1944
+ $product_discount_details['discount_quantity'] = $quantity;
1945
+ $product_discount_details['discount_price'] = $discount_price;
1946
+ $adjustment['product_discount_details'] = $product_discount_details;
1947
  }
1948
+ }
1949
+ }
1950
+ }
1951
+ if($has_set_discount){
1952
+ $discount_price = $set_discount_range->to_discount;
1953
+ $product_discount_details = array();
1954
+ $set_discount_values = $this->getSetDiscountValueForTheProduct($item, $rule, $set_discount_range, $set_discount_min_qty, $quantity, $product_page);
1955
+
1956
+ if($set_discount_values['has_discount'] === true){
1957
+ $apply_for_qty = $set_discount_values['quantity'];
1958
+ $current_product_qty = $set_discount_values['current_product_quantity'];
1959
+ $non_discount_qty = $set_discount_values['quantity_does_not_has_discount'];
1960
+ $product_price = FlycartWoocommerceProduct::get_price($item['data']);
1961
+ $subtotal = $non_discount_qty * $product_price;
1962
+ $discount_per_unit = $discount_price/$set_discount_min_qty;
1963
+ $discounted_price_per_product = $product_price - $discount_per_unit;
1964
+ $subtotal += ($discount_per_unit*$apply_for_qty);
1965
+ $discount_on_each_item = $subtotal / $current_product_qty;
1966
+ $adjustment['set_discount'] = $discount_on_each_item;
1967
+ $product_discount_details['discount_type'] = 'set_discount';
1968
+ $product_discount_details['discount_value'] = $discount_on_each_item;
1969
+ $product_discount_details['discount_quantity'] = $apply_for_qty;
1970
+ $product_discount_details['discount_price'] = $discounted_price_per_product;
1971
+ $adjustment['product_discount_details'] = $product_discount_details;
1972
+ }
1973
+ }
1974
+ }
1975
+ return $adjustment;
1976
+ }
1977
+
1978
+ /**
1979
+ * Get set discount values
1980
+ * */
1981
+ protected function getSetDiscountValueForTheProduct($item, $rule, $set_discount_range, $set_discount_min_qty, $quantity, $product_page){
1982
+ $set_discount_values = array();
1983
+ $set_discount_values['has_discount'] = false;
1984
+ $cart = FlycartWoocommerceCart::get_cart();
1985
+ $cart_item_key = (!empty($item['key']))? $item['key']: '';
1986
+ $balance_to_apply = $set_discount_min_qty;
1987
+ if(!empty($cart)){
1988
+ foreach ($cart as $key => $cart_item){
1989
+ $current_cart_item_key = $cart_item['key'];
1990
+ $current_cart_item_quantity = $cart_item['quantity'];
1991
+ $has_discount = $this->isProductApplicableForSetDiscount($cart_item, $rule);
1992
+ if($has_discount['status'] === true){
1993
+ $set_discount_values['cumulative'] = $has_discount['cumulative'];
1994
+ if($cart_item_key == $current_cart_item_key){
1995
+ if($balance_to_apply > $current_cart_item_quantity){
1996
+ $set_discount_values['quantity'] = $current_cart_item_quantity;
1997
  } else {
1998
+ $set_discount_values['quantity'] = $balance_to_apply;
 
1999
  }
2000
+ $set_discount_values['quantity_does_not_has_discount'] = $current_cart_item_quantity - $set_discount_values['quantity'];
2001
+ $set_discount_values['has_discount'] = true;
2002
+ $set_discount_values['current_product_quantity'] = $current_cart_item_quantity;
2003
+ if(!$product_page){
2004
+ break;
2005
+ }
2006
+ }
2007
+ if($has_discount['cumulative'] === true){
2008
+ $balance_to_apply -= $current_cart_item_quantity;
2009
+ }
2010
+ if($balance_to_apply <= 0){
2011
+ break;
2012
  }
2013
  }
2014
  }
2015
  }
2016
+ if($product_page){
2017
+ $has_discount = $this->isProductApplicableForSetDiscount($item, $rule);
2018
+ if($has_discount['status'] === true){
2019
+ $set_discount_values['cumulative'] = $has_discount['cumulative'];
2020
+ if($balance_to_apply > $quantity){
2021
+ $set_discount_values['quantity'] = $quantity;
2022
+ } else {
2023
+ $set_discount_values['quantity'] = $balance_to_apply;
2024
+ }
2025
+ $product_qty_in_product_page = 1;
2026
+ if($this->custom_qty > 0){
2027
+ $product_qty_in_product_page = $this->custom_qty;
2028
+ }
2029
 
2030
+ if($set_discount_values['quantity'] > $product_qty_in_product_page){
2031
+ $quantity_to_apply = $product_qty_in_product_page;
2032
+ $quantity_does_not_has_discount = 0;
2033
+ } else {
2034
+ $quantity_to_apply = $set_discount_values['quantity'];
2035
+ $quantity_does_not_has_discount = $product_qty_in_product_page - $set_discount_values['quantity'];
2036
+ }
2037
+ $set_discount_values['quantity'] = $quantity_to_apply;
2038
+ $set_discount_values['quantity_does_not_has_discount'] = $quantity_does_not_has_discount;
2039
+ $set_discount_values['has_discount'] = true;
2040
+ $set_discount_values['current_product_quantity'] = $product_qty_in_product_page;
2041
+ }
2042
+ }
2043
+
2044
+ return $set_discount_values;
2045
+ }
2046
+
2047
+ /**
2048
+ * Is product is applicable for set discount
2049
+ *
2050
+ * @param $item array
2051
+ * @param $rule array
2052
+ * @return array
2053
+ * */
2054
+ protected function isProductApplicableForSetDiscount($item, $rule){
2055
+ $result['status'] = false;
2056
+ $result['cumulative'] = false;
2057
+ // Working with Products and Category.
2058
+ switch ($rule['apply_to']) {
2059
+
2060
+ case 'specific_products':
2061
+ if ($this->isItemInProductList($rule['type']['specific_products'], $item)) {
2062
+ $result['status'] = true;
2063
+ if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
2064
+ $result['cumulative'] = true;
2065
+ }
2066
+ }
2067
+ break;
2068
+
2069
+ case 'specific_category':
2070
+ $notInProductList = !$this->isItemInProductList($rule['product_to_exclude'], $item);
2071
+ $is_not_in_exclude_sale_items = !$this->isItemInSaleItems($rule['exclude_sale_items'], $item['data']);
2072
+ if ($this->isItemInCategoryList($rule['type']['specific_category'], $item) && $notInProductList && $is_not_in_exclude_sale_items) {
2073
+ $result['status'] = true;
2074
+ if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
2075
+ $result['cumulative'] = true;
2076
+ }
2077
+ }
2078
+ break;
2079
+ case 'specific_attribute':
2080
+ $notInProductList = !$this->isItemInProductList($rule['product_to_exclude'], $item);
2081
+ $is_not_in_exclude_sale_items = !$this->isItemInSaleItems($rule['exclude_sale_items'], $item['data']);
2082
+ if ($this->isItemInAttributeList($rule['type']['specific_attribute'], $item) && $notInProductList && $is_not_in_exclude_sale_items) {
2083
+ $result['status'] = true;
2084
+ if(isset($rule['type']['is_cumulative']) && $rule['type']['is_cumulative']){
2085
+ $result['cumulative'] = true;
2086
+ }
2087
+ }
2088
+ break;
2089
+
2090
+ case 'all_products':
2091
+ default:
2092
+ $is_not_in_exclude_sale_items = !$this->isItemInSaleItems($rule['exclude_sale_items'], $item['data']);
2093
+ if (!$this->isItemInProductList($rule['product_to_exclude'], $item) && $is_not_in_exclude_sale_items) {
2094
+ $result['status'] = true;
2095
+ if(isset($rule['is_cumulative_for_products']) && $rule['is_cumulative_for_products']){
2096
+ $result['cumulative'] = true;
2097
+ }
2098
+ }
2099
+
2100
+ break;
2101
+ }
2102
+
2103
+ return $result;
2104
  }
2105
 
2106
  /**
3085
  }
3086
  $condition .= ' '.trim($htmlProduct, ', ').' ';
3087
  }
3088
+ $condition .= esc_html__(' and get discount on ', 'woo-discount-rules');
3089
  if($get_discount_type == 'product'){
3090
  if($product_to_apply_count_option == 'apply_first'){
3091
  $condition .= esc_html__(' first ', 'woo-discount-rules');
3176
  if (isset($base_config['show_discount_title_table'])) {
3177
  }
3178
  $condition = $min .' - ' . $max;
3179
+ if($discount_type == 'set_discount'){
3180
+ $condition = $min;
3181
+ }
3182
  if ($discount_type == 'product_discount') {
3183
  $htmlProduct = '';
3184
  $htmlProduct .= esc_html__('Get ', 'woo-discount-rules');
3226
  $discount = trim($htmlProduct, '<br>');
3227
  } else if ($discount_type == 'percentage_discount') {
3228
  $discount = $to_discount.' %';
3229
+ } else if ($discount_type == 'set_discount') {
3230
+ $discount = sprintf(esc_html__('%s for %s Quantity(s)', 'woo-discount-rules'), FlycartWoocommerceProduct::wc_price($to_discount), $min);
3231
+ } else if ($discount_type == 'fixed_price') {
3232
+ $discount = sprintf(esc_html__('%s as price per unit', 'woo-discount-rules'), FlycartWoocommerceProduct::wc_price($to_discount));
3233
  } else {
3234
  $discount = FlycartWoocommerceProduct::wc_price($to_discount);
3235
  }
3410
  return $discount;
3411
  }
3412
  $details = $rule_data = array();
3413
+ $has_discount = false;
3414
  foreach ($sets as $id => $set) {
3415
  // For the First price, it will return the amount after get hit.
3416
+ $amount_type = (isset($set['amount']['percentage_discount']) ? 'percentage_discount' : '');
3417
+ $amount_type = (isset($set['amount']['price_discount']) ? 'price_discount' : $amount_type);
3418
+ $amount_type = (isset($set['amount']['fixed_price']) ? 'fixed_price' : $amount_type);
3419
+ $amount_type = (isset($set['amount']['set_discount']) ? 'set_discount' : $amount_type);
3420
  if ($by == 'first') {
3421
  if(empty($set['amount'])){
3422
  continue;
3432
  }
3433
  }
3434
  }
3435
+ } else if ($amount_type == 'fixed_price' || $amount_type == 'set_discount') {
3436
+ $fixed_discount_price = $set['amount'][$amount_type];
3437
+ $discount = $price - $fixed_discount_price;
3438
+ if($discount < 0){
3439
+ $discount = 0;
3440
+ }
3441
+ if($product_page){
3442
+ if(get_option('woocommerce_prices_include_tax', 'no') == 'no'){
3443
+ if(get_option('woocommerce_tax_display_shop', 'incl') == 'incl'){
3444
+ $discount = FlycartWoocommerceProduct::get_price_including_tax($product, 1, $discount);
3445
+ }
3446
+ }
3447
+ }
3448
  }
3449
  $discount = apply_filters('woo_discount_rules_discount_amount_before_apply', $discount, $set, $price, $product_page, $product);
3450
  if(isset($set['rule_order'])){
3455
  $details[] = isset($set['amount']['product_discount_details'])? $set['amount']['product_discount_details'] : array();
3456
  return array('amount' => $discount, 'details' => $details, 'rule' => $rule_data);
3457
  } else {
 
3458
  // For All, All rules going to apply.
3459
  if (isset($set['amount']['percentage_discount'])) {
3460
  $discount = ($price / 100) * $set['amount']['percentage_discount'];
3475
  // Append all Discounts.
3476
  $overall_discount = $overall_discount + $discount;
3477
  $has_discount = 1;
3478
+ } else if ($amount_type == 'fixed_price' || $amount_type == 'set_discount') {
3479
+ $fixed_discount_price = $set['amount'][$amount_type];
3480
+ $discount = $price - $fixed_discount_price;
3481
+ if($discount < 0){
3482
+ $discount = 0;
3483
+ }
3484
+ if($product_page){
3485
+ if(get_option('woocommerce_prices_include_tax', 'no') == 'no'){
3486
+ if(get_option('woocommerce_tax_display_shop', 'incl') == 'incl'){
3487
+ $discount = FlycartWoocommerceProduct::get_price_including_tax($product, 1, $discount);
3488
+ }
3489
+ }
3490
+ }
3491
+ $discount = apply_filters('woo_discount_rules_discount_amount_before_apply', $discount, $set, $price, $product_page, $product);
3492
+ // Append all Discounts.
3493
+ $overall_discount = $overall_discount + $discount;
3494
+ $has_discount = 1;
3495
  }
3496
  if(isset($set['rule_order']) && $has_discount){
3497
  $rule_data[$set['rule_order']] = $set['item'];
3516
  $details = $rule_data = array();
3517
  if(is_array($discount_list) && count($discount_list)){
3518
  foreach ($discount_list as $id => $discount_item) {
3519
+ $amount_type = (isset($discount_item['amount']['percentage_discount']) ? 'percentage_discount' : '');
3520
+ $amount_type = (isset($discount_item['amount']['price_discount']) ? 'price_discount' : $amount_type);
3521
+ $amount_type = (isset($discount_item['amount']['fixed_price']) ? 'fixed_price' : $amount_type);
3522
+ $amount_type = (isset($discount_item['amount']['set_discount']) ? 'set_discount' : $amount_type);
3523
  if ($amount_type == 'percentage_discount') {
3524
  if (isset($discount_item['amount']['percentage_discount'])) {
3525
  $amount = (($price / 100) * $discount_item['amount']['percentage_discount']);
3526
  }
3527
+ } else if($amount_type == 'fixed_price' || $amount_type == 'set_discount') {
3528
+ if (isset($discount_item['amount'][$amount_type])) {
3529
+ $amount = $price - $discount_item['amount'][$amount_type];
3530
+ if($amount < 0){
3531
+ $amount = 0;
3532
+ }
3533
+ if($product_page){
3534
+ if(get_option('woocommerce_prices_include_tax', 'no') == 'no'){
3535
+ if(get_option('woocommerce_tax_display_shop', 'incl') == 'incl'){
3536
+ $amount = FlycartWoocommerceProduct::get_price_including_tax($product, 1, $amount);
3537
+ }
3538
+ }
3539
+ }
3540
+ }
3541
  } else {
3542
  if (isset($discount_item['amount']['price_discount'])) {
3543
  $amount = $discount_item['amount']['price_discount'];
3620
  'log' => $log,
3621
  'additional_details' => $additionalDetails,
3622
  );
3623
+ $has_wpml = false;
3624
  global $WOOCS;
3625
  if(isset($WOOCS)){
3626
  if (method_exists($WOOCS, 'get_currencies')){
3631
  //woocs_is_geoip_manipulation //woocs_is_fixed_enabled
3632
  if($is_geoip_manipulation || $woocs_is_fixed_enabled || $woocs_convert_value_based_on_currency){
3633
  $amount = $amount / $currencies[$WOOCS->current_currency]['rate'];
3634
+ $original_price = $original_price / $currencies[$WOOCS->current_currency]['rate'];
3635
+ $has_wpml = true;
3636
  }
3637
  }
3638
  }
3640
  $amount_excluding_tax = FlycartWoocommerceProduct::get_price_excluding_tax($original_product, 1, $amount);
3641
  //for future reference
3642
  $discount_amount = $original_price - $amount;
3643
+ if($has_wpml === true){
3644
+ $discount_amount = $discount_amount*$currencies[$WOOCS->current_currency]['rate'];
3645
+ }
3646
  $discount_amount = get_option('woocommerce_tax_display_cart') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($original_product, 1, $discount_amount) : FlycartWoocommerceProduct::get_price_including_tax($original_product, 1, $discount_amount);
3647
 
3648
  $discount_amount_excluding_tax = $original_price_excluding_tax - $amount_excluding_tax;
3649
+ if($has_wpml === true){
3650
+ $discount_amount_excluding_tax = $discount_amount_excluding_tax*$currencies[$WOOCS->current_currency]['rate'];
3651
+ }
3652
  $woocommerce->cart->cart_contents[$item]['woo_discount']['discounted_price_per_product'] = $amount;
3653
  $woocommerce->cart->cart_contents[$item]['woo_discount']['discounted_price_total'] = $amount * $woocommerce->cart->cart_contents[$item]['quantity'];
3654
  $woocommerce->cart->cart_contents[$item]['woo_discount']['discount_amount'] = $discount_amount;
includes/survey.php ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
+ class FlycartWooDiscountRulesSurvey
5
+ {
6
+ public $plugin, $plugin_text_domain, $name;
7
+ protected $token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NjYzODMxODAsImV4cCI6NDI4MDI3MzE4MH0.RzNuhNyCu9oydkY9NRGFhFmQI0ALWBP0B1AmHub57XE";
8
+ protected $endpoint = "https://feedback.flycart.org/.netlify/functions/feedback";
9
+
10
+ /**
11
+ * init the survey
12
+ * @param $plugin
13
+ * @param $text_domain
14
+ * @param $plugin_name
15
+ * @return null
16
+ */
17
+ function init($plugin, $plugin_name, $text_domain)
18
+ {
19
+ $this->plugin = $plugin;
20
+ $this->name = $plugin_name;
21
+ $this->plugin_text_domain = $text_domain;
22
+ if ($this->isPluginPage() || !$this->isDevelopmentSite()) {
23
+ add_action('admin_print_scripts', array($this, 'js'), 20);
24
+ add_action('admin_print_scripts', array($this, 'css'));
25
+ add_action('admin_footer', array($this, 'modal'));
26
+ }
27
+ return NULL;
28
+ }
29
+
30
+ /**
31
+ * Print the required js
32
+ */
33
+ function js()
34
+ {
35
+ $display_name = '';
36
+ if (is_user_logged_in()) {
37
+ if (function_exists('wp_get_current_user')) {
38
+ $user = wp_get_current_user();
39
+ } elseif (function_exists('get_currentuserinfo')) {
40
+ $user = get_currentuserinfo();
41
+ }
42
+ if (!empty($user)) {
43
+ $display_name = isset($user->display_name) ? $user->display_name : '';
44
+ }
45
+ }
46
+ ?>
47
+ <script type="text/javascript">
48
+ jQuery(function ($) {
49
+ var $deactivateLink = $('#the-list').find('[data-slug="<?php echo $this->plugin; ?>"] span.deactivate a'),
50
+ $overlay = $('#plugin-deactivate-survey-<?php echo $this->plugin; ?>'),
51
+ $form = $overlay.find('form'),
52
+ formOpen = false;
53
+ // Plugin listing table deactivate link.
54
+ $deactivateLink.on('click', function (event) {
55
+ event.preventDefault();
56
+ $overlay.css('display', 'table');
57
+ formOpen = true;
58
+ $form.find('.<?php echo $this->plugin; ?>-deactivate-survey-option:first-of-type input[type=radio]').focus();
59
+ });
60
+ // Survey radio option selected.
61
+ $form.on('change', 'input[type=radio]', function (event) {
62
+ event.preventDefault();
63
+ $form.find('input[type=text], .error').hide();
64
+ $form.find('.<?php echo $this->plugin; ?>-deactivate-survey-option').removeClass('selected');
65
+ $(this).closest('.<?php echo $this->plugin; ?>-deactivate-survey-option').addClass('selected').find('input[type=text]').show();
66
+ });
67
+ // Survey Skip & Deactivate.
68
+ $form.on('click', '.<?php echo $this->plugin; ?>-deactivate-survey-deactivate', function (event) {
69
+ event.preventDefault();
70
+ location.href = $deactivateLink.attr('href');
71
+ });
72
+ // close button
73
+ $form.on('click', '.<?php echo $this->plugin; ?>-deactivate-survey-close', function (event) {
74
+ event.preventDefault();
75
+ $overlay.css('display', 'none');
76
+ formOpen = false;
77
+ });
78
+ // Survey submit.
79
+ $form.submit(function (event) {
80
+ event.preventDefault();
81
+ if (!$form.find('input[type=radio]:checked').val()) {
82
+ $form.find('.<?php echo $this->plugin; ?>-deactivate-survey-footer').prepend('<span class="error"><?php echo esc_js(__('Please select an option', $this->plugin_text_domain)); ?></span>');
83
+ return;
84
+ }
85
+ $form.find('.<?php echo $this->plugin; ?>-deactivate-survey-submit').html('<?php echo esc_js(__('Sending Feedback', $this->plugin_text_domain)); ?>').attr("disabled", true).removeClass('button-primary');
86
+ var reason = $form.find('.selected .<?php echo $this->plugin; ?>-deactivate-survey-option-reason').val();
87
+ if (reason === "Other") {
88
+ reason = $form.find('.selected input[type=text]').val();
89
+ }
90
+ var request_data = {
91
+ subject: "Discount Rules for WooCommerce plugin deactivation survey form!",
92
+ message: reason,
93
+ url: '<?php echo esc_url(home_url()); ?>',
94
+ name: '<?php echo $display_name; ?>',
95
+ code: $form.find('.selected input[type=radio]').val(),
96
+ token: "<?php echo $this->token ?>"
97
+ };
98
+ var submitSurvey = $.ajax(
99
+ {
100
+
101
+ url: "<?php echo $this->endpoint; ?>",
102
+ type: "POST",
103
+ data: JSON.stringify(request_data),
104
+ dataType: 'json',
105
+ async: false,
106
+ success: function (msg) {
107
+ location.href = $deactivateLink.attr('href');
108
+ },
109
+ error: function (msg) {
110
+ location.href = $deactivateLink.attr('href');
111
+ }
112
+ }
113
+ )
114
+ });
115
+
116
+ // Exit key closes survey when open.
117
+ $(document).keyup(function (event) {
118
+ if (27 === event.keyCode && formOpen) {
119
+ $overlay.hide();
120
+ formOpen = false;
121
+ $deactivateLink.focus();
122
+ }
123
+ });
124
+ });
125
+ </script>
126
+ <?php
127
+ }
128
+
129
+ /**
130
+ * CSS required for survey form
131
+ */
132
+ function css()
133
+ {
134
+ ?>
135
+ <style type="text/css">
136
+ .<?php echo $this->plugin; ?>-deactivate-survey-modal {
137
+ display: none;
138
+ table-layout: fixed;
139
+ position: fixed;
140
+ z-index: 9999;
141
+ width: 100%;
142
+ height: 100%;
143
+ text-align: center;
144
+ font-size: 14px;
145
+ top: 0;
146
+ left: 0;
147
+ background: rgba(0, 0, 0, 0.8);
148
+ }
149
+
150
+ .<?php echo $this->plugin; ?>-deactivate-survey-wrap {
151
+ display: table-cell;
152
+ vertical-align: middle;
153
+ }
154
+
155
+ .<?php echo $this->plugin; ?>-deactivate-survey {
156
+ background-color: #fff;
157
+ max-width: 550px;
158
+ margin: 0 auto;
159
+ padding: 30px;
160
+ text-align: left;
161
+ }
162
+
163
+ .<?php echo $this->plugin; ?>-deactivate-survey .error {
164
+ display: block;
165
+ color: red;
166
+ margin: 0 0 10px 0;
167
+ }
168
+
169
+ .<?php echo $this->plugin; ?>-deactivate-survey-header {
170
+ display: block;
171
+ font-size: 18px;
172
+ font-weight: 700;
173
+ text-transform: uppercase;
174
+ border-bottom: 1px solid #ddd;
175
+ padding: 0 0 18px 0;
176
+ margin: 0 0 18px 0;
177
+ position: relative;
178
+ }
179
+
180
+ .<?php echo $this->plugin; ?>-deactivate-survey-title {
181
+ text-align: left;
182
+ }
183
+
184
+ .<?php echo $this->plugin; ?>-deactivate-survey-close {
185
+ text-align: right;
186
+ position: absolute;
187
+ right: 0px;
188
+ font-size: 24px;
189
+ cursor: pointer;
190
+ }
191
+
192
+ .<?php echo $this->plugin; ?>-deactivate-survey-title span {
193
+ color: #999;
194
+ margin-right: 10px;
195
+ }
196
+
197
+ .<?php echo $this->plugin; ?>-deactivate-survey-desc {
198
+ display: block;
199
+ font-weight: 600;
200
+ margin: 0 0 18px 0;
201
+ }
202
+
203
+ .<?php echo $this->plugin; ?>-deactivate-survey-option {
204
+ margin: 0 0 10px 0;
205
+ }
206
+
207
+ .<?php echo $this->plugin; ?>-deactivate-survey-option-input {
208
+ margin-right: 10px !important;
209
+ }
210
+
211
+ .<?php echo $this->plugin; ?>-deactivate-survey-option-details {
212
+ display: none;
213
+ width: 90%;
214
+ margin: 10px 0 0 30px;
215
+ }
216
+
217
+ .<?php echo $this->plugin; ?>-deactivate-survey-footer {
218
+ margin-top: 18px;
219
+ }
220
+
221
+ .<?php echo $this->plugin; ?>-deactivate-survey-deactivate {
222
+ float: right;
223
+ font-size: 13px;
224
+ color: #ccc;
225
+ text-decoration: none;
226
+ padding-top: 7px;
227
+ }
228
+ </style>
229
+ <?php
230
+ }
231
+
232
+ /**
233
+ * Modal window showing survey
234
+ */
235
+ function modal()
236
+ {
237
+ $options = array(
238
+ 1 => array(
239
+ 'title' => esc_html__('I am switching to a different discount plugin.', $this->plugin_text_domain),
240
+ 'reason' => 'I am switching to a different discount plugin.'
241
+ ),
242
+ 2 => array(
243
+ 'title' => esc_html__('I could not get my discount rule to work.', $this->plugin_text_domain),
244
+ 'reason' => 'I could not get my discount rule to work.'
245
+ ),
246
+ 3 => array(
247
+ 'title' => esc_html__('It does not meet my discount requirements.', $this->plugin_text_domain),
248
+ 'reason' => 'It does not meet my discount requirements.'
249
+ ),
250
+ 4 => array(
251
+ 'title' => esc_html__('Plugin is complex.', $this->plugin_text_domain),
252
+ 'reason' => 'Plugin is complex.'
253
+ ),
254
+ 5 => array(
255
+ 'title' => esc_html__('I\'m trying to troubleshoot the plugin.', $this->plugin_text_domain),
256
+ 'reason' => 'I\'m trying to troubleshoot the plugin.'
257
+ ),
258
+ 6 => array(
259
+ 'title' => esc_html__('I was instructed to deactivate by Flycart Support.', $this->plugin_text_domain),
260
+ 'reason' => 'I was instructed to deactivate by Flycart Support.'
261
+ ),
262
+ 7 => array(
263
+ 'title' => esc_html__('I no longer use this plugin.', $this->plugin_text_domain),
264
+ 'reason' => 'I no longer use this plugin.'
265
+ ),
266
+ 8 => array(
267
+ 'title' => esc_html__('It\'s a temporary deactivation.', $this->plugin_text_domain),
268
+ 'reason' => 'It\'s a temporary deactivation.'
269
+ ),
270
+ 9 => array(
271
+ 'title' => esc_html__('Other', $this->plugin_text_domain),
272
+ 'reason' => 'Other',
273
+ 'details' => esc_html__('Please share the reason', $this->plugin_text_domain),
274
+ ),
275
+ );
276
+ ?>
277
+ <div class="<?php echo $this->plugin; ?>-deactivate-survey-modal"
278
+ id="plugin-deactivate-survey-<?php echo $this->plugin; ?>">
279
+ <div class="<?php echo $this->plugin; ?>-deactivate-survey-wrap">
280
+ <form class="<?php echo $this->plugin; ?>-deactivate-survey" method="post">
281
+ <span class="<?php echo $this->plugin; ?>-deactivate-survey-header">
282
+ <span class="dashicons dashicons-testimonial"></span>
283
+ <?php echo ' ' . esc_html__('Quick Feedback', $this->plugin_text_domain); ?>
284
+ <span title="<?php esc_attr_e('Close', $this->plugin_text_domain); ?> "
285
+ class="<?php echo $this->plugin; ?>-deactivate-survey-close">✕</span>
286
+ </span>
287
+
288
+ <span class="<?php echo $this->plugin; ?>-deactivate-survey-desc">
289
+ <?php
290
+ printf(
291
+ /* translators: %s - plugin name. */
292
+ esc_html__('If you have a moment, please share why you are deactivating %s:', $this->plugin_text_domain),
293
+ esc_html__('Discount Rules for WooCommerce', $this->plugin_text_domain)
294
+ );
295
+ ?>
296
+ </span>
297
+ <div class="<?php echo $this->plugin; ?>-deactivate-survey-options">
298
+ <?php foreach ($options as $id => $option) : ?>
299
+ <div class="<?php echo $this->plugin; ?>-deactivate-survey-option">
300
+ <label for="<?php echo $this->plugin; ?>-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>"
301
+ class="<?php echo $this->plugin; ?>-deactivate-survey-option-label">
302
+ <input id="<?php echo $this->plugin; ?>-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>"
303
+ class="<?php echo $this->plugin; ?>-deactivate-survey-option-input"
304
+ type="radio"
305
+ name="code" value="<?php echo $id; ?>"/>
306
+ <span class="<?php echo $this->plugin; ?>-deactivate-survey-option-title"><?php echo $option['title']; ?></span>
307
+ <input class="<?php echo $this->plugin; ?>-deactivate-survey-option-reason"
308
+ type="hidden"
309
+ value="<?php echo $option['reason']; ?>"/>
310
+ </label>
311
+ <?php if (!empty($option['details'])) : ?>
312
+ <input class="<?php echo $this->plugin; ?>-deactivate-survey-option-details"
313
+ type="text"
314
+ placeholder="<?php echo $option['details']; ?>"/>
315
+ <?php endif; ?>
316
+ </div>
317
+ <?php endforeach; ?>
318
+ </div>
319
+ <div class="<?php echo $this->plugin; ?>-deactivate-survey-footer">
320
+ <button type="submit"
321
+ class="<?php echo $this->plugin; ?>-deactivate-survey-submit button button-primary button-large"><?php echo esc_html__('Submit & Deactivate', $this->plugin_text_domain); ?></button>
322
+ <a href="#"
323
+ class="<?php echo $this->plugin; ?>-deactivate-survey-deactivate"><?php echo esc_html__('Skip & Deactivate', $this->plugin_text_domain); ?></a>
324
+ </div>
325
+ </form>
326
+ </div>
327
+ </div>
328
+ <?php
329
+ }
330
+
331
+ /**
332
+ * Check this page is plugin page or not
333
+ * @return bool
334
+ */
335
+ function isPluginPage()
336
+ {
337
+ $screen = function_exists('get_current_screen') ? get_current_screen() : false;
338
+ if (empty($screen)) {
339
+ return false;
340
+ }
341
+ return (!empty($screen->id) && in_array($screen->id, array('plugins', 'plugins-network'), true));
342
+ }
343
+
344
+ /**
345
+ * Checks if current site is a development one.
346
+ * @return bool
347
+ */
348
+ public function isDevelopmentSite()
349
+ {
350
+ // If it is an AM dev site, return false, so we can see them on our dev sites.
351
+ if (defined('AWESOMEMOTIVE_DEV_MODE') && AWESOMEMOTIVE_DEV_MODE) {
352
+ return false;
353
+ }
354
+ $url = network_site_url('/');
355
+ $is_local_url = false;
356
+ // Trim it up
357
+ $url = strtolower(trim($url));
358
+ // Need to get the host...so let's add the scheme so we can use parse_url
359
+ if (false === strpos($url, 'http://') && false === strpos($url, 'https://')) {
360
+ $url = 'http://' . $url;
361
+ }
362
+ $url_parts = parse_url($url);
363
+ $host = !empty($url_parts['host']) ? $url_parts['host'] : false;
364
+ if (!empty($url) && !empty($host)) {
365
+ if (false !== ip2long($host)) {
366
+ if (!filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
367
+ $is_local_url = true;
368
+ }
369
+ } else if ('localhost' === $host) {
370
+ $is_local_url = true;
371
+ }
372
+ $tlds_to_check = array('.dev', '.local', ':8888');
373
+ foreach ($tlds_to_check as $tld) {
374
+ if (false !== strpos($host, $tld)) {
375
+ $is_local_url = true;
376
+ continue;
377
+ }
378
+ }
379
+ if (substr_count($host, '.') > 1) {
380
+ $subdomains_to_check = array('dev.', '*.staging.', 'beta.', 'test.');
381
+ foreach ($subdomains_to_check as $subdomain) {
382
+ $subdomain = str_replace('.', '(.)', $subdomain);
383
+ $subdomain = str_replace(array('*', '(.)'), '(.*)', $subdomain);
384
+ if (preg_match('/^(' . $subdomain . ')/', $host)) {
385
+ $is_local_url = true;
386
+ continue;
387
+ }
388
+ }
389
+ }
390
+ }
391
+ return $is_local_url;
392
+ }
393
+ }
loader.php CHANGED
@@ -81,6 +81,7 @@ if(!class_exists('FlycartWooDiscountRules')){
81
  include_once(dirname(__FILE__).'/includes/discount-base.php');
82
  include_once(dirname(__FILE__).'/helper/purchase.php');
83
  include_once(dirname(__FILE__).'/includes/compatibility.php');
 
84
  require_once __DIR__ . '/vendor/autoload.php';
85
  }
86
 
@@ -161,6 +162,15 @@ if(!class_exists('FlycartWooDiscountRules')){
161
  return $pluginInfo;
162
  }
163
 
 
 
 
 
 
 
 
 
 
164
  /**
165
  * Load Admin scripts
166
  * */
@@ -187,6 +197,8 @@ if(!class_exists('FlycartWooDiscountRules')){
187
  add_action( 'woocommerce_admin_order_totals_after_total', array( $this->pricingRules, 'displayTotalSavingsThroughDiscountInOrder'), 10);
188
  }
189
  add_filter( 'plugin_action_links_' . WOO_DISCOUNT_PLUGIN_BASENAME, array('FlycartWooDiscountBase', 'addActionLinksInPluginPage') );
 
 
190
  }
191
 
192
  /**
@@ -404,7 +416,7 @@ if(!class_exists('FlycartWooDiscountRules')){
404
 
405
  //replace visible price in product page
406
  add_filter('woocommerce_get_price_html', array($this->pricingRules, 'replaceVisiblePricesOptimized'), 100, 3);
407
- add_filter('woocommerce_get_price_html', array($this->pricingRules, 'replaceVisiblePricesForSalePriceAdjustment'), 99, 3);
408
 
409
  //replace visible price in product page for variant
410
  add_filter('woocommerce_available_variation', array($this->pricingRules, 'replaceVisiblePricesForVariant'), 100, 3);
81
  include_once(dirname(__FILE__).'/includes/discount-base.php');
82
  include_once(dirname(__FILE__).'/helper/purchase.php');
83
  include_once(dirname(__FILE__).'/includes/compatibility.php');
84
+ include_once(dirname(__FILE__).'/includes/survey.php');
85
  require_once __DIR__ . '/vendor/autoload.php';
86
  }
87
 
162
  return $pluginInfo;
163
  }
164
 
165
+ /**
166
+ * Show up the survey form
167
+ */
168
+ function setupSurveyForm()
169
+ {
170
+ $survey = new FlycartWooDiscountRulesSurvey();
171
+ $survey->init('woo-discount-rules', 'Discount Rules for WooCommerce', 'woo-discount-rules');
172
+ }
173
+
174
  /**
175
  * Load Admin scripts
176
  * */
197
  add_action( 'woocommerce_admin_order_totals_after_total', array( $this->pricingRules, 'displayTotalSavingsThroughDiscountInOrder'), 10);
198
  }
199
  add_filter( 'plugin_action_links_' . WOO_DISCOUNT_PLUGIN_BASENAME, array('FlycartWooDiscountBase', 'addActionLinksInPluginPage') );
200
+
201
+ add_action('admin_init', array($this, 'setupSurveyForm'), 10);
202
  }
203
 
204
  /**
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
422
  add_filter('woocommerce_available_variation', array($this->pricingRules, 'replaceVisiblePricesForVariant'), 100, 3);
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.7.20
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -48,6 +48,7 @@ Display the pricing discount table beautifully on the product page. Start sellin
48
  * [Specific product based discounts (Buy Product A and get 10% discount)](http://docs.flycart.org/woocommerce-discount-rules/percentage-discount-examples/product-specific-discount-get-10-discount-adidas-shoe)
49
  * [User role based dynamic pricing and discounts for your WooCommerce store (Example: Wholesale customers get a discounted price)](http://docs.flycart.org/woocommerce-discount-rules/examples/user-role-based-discount-rules)
50
  * Dependant product based discounts (Buy Product A and get discount on Product B)
 
51
  * Offer one or more free products (Multiple products could be offered free using a rule)
52
  * [Coupon code activated discount rules - The discount will apply after a coupon is entered.](http://docs.flycart.org/woocommerce-discount-rules/examples/activate-discount-rule-using-a-coupon-code-in-woocommerce)
53
  * Option to set discount for each product variant.
@@ -129,12 +130,24 @@ Display the pricing discount table beautifully on the product page. Start sellin
129
  * Shoes get 20% discount, T-Shirts get 5% discount
130
  * Adidas Special Edition Shoe (A specific product) gets 15% discount for 10 days
131
  * Buy 10 mugs are more and get 5% off – [Video](https://www.youtube.com/watch?v=7ZeRIKXWFmE)
 
 
 
 
 
 
 
132
 
133
  = User Role based Discount =
134
 
135
  * Bulk discount based on user role for specific product or product categories.
136
  * Members of Wholesale customers group gets 40% discount, while Retail customers get 5% discount
137
 
 
 
 
 
 
138
  = Discount rules activated by coupon =
139
 
140
  * Activate / Trigger a discount rule upon entering a coupon code (useful when you want to provide discount to a target group of users)
@@ -159,6 +172,7 @@ Display the pricing discount table beautifully on the product page. Start sellin
159
  * Discount based on the total amount spent by the customer in previous orders
160
  * Discount based on the total number of orders placed by the customer
161
  * Based on purchase history (Example: Provide 10% discount to all customers who purchased Shoes earlier)
 
162
 
163
  = Adjustment rules =
164
 
@@ -193,6 +207,10 @@ Conditions can be based products, categories, customers, customer roles, shippin
193
  * Cart subtotal
194
  * Line item quantity
195
  * Total cart quantity
 
 
 
 
196
 
197
  = Need assistance with the discount set up? Reach out to us =
198
 
@@ -318,6 +336,14 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
318
 
319
  == Changelog ==
320
 
 
 
 
 
 
 
 
 
321
  = 1.7.20 - 23/09/19 =
322
  * Feature - Option for Product in list, Exclude product, Exclude on sale product in cart rules.
323
  * Feature - Duration option(Last 7 days, 14 days, 30 days, 60 days, 90 days, 180 days, 1 year, Custom) in purchase history based 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.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
48
  * [Specific product based discounts (Buy Product A and get 10% discount)](http://docs.flycart.org/woocommerce-discount-rules/percentage-discount-examples/product-specific-discount-get-10-discount-adidas-shoe)
49
  * [User role based dynamic pricing and discounts for your WooCommerce store (Example: Wholesale customers get a discounted price)](http://docs.flycart.org/woocommerce-discount-rules/examples/user-role-based-discount-rules)
50
  * Dependant product based discounts (Buy Product A and get discount on Product B)
51
+ * Bundle / package deal (Buy 3 items for $10. 4th item will be charge full price)
52
  * Offer one or more free products (Multiple products could be offered free using a rule)
53
  * [Coupon code activated discount rules - The discount will apply after a coupon is entered.](http://docs.flycart.org/woocommerce-discount-rules/examples/activate-discount-rule-using-a-coupon-code-in-woocommerce)
54
  * Option to set discount for each product variant.
130
  * Shoes get 20% discount, T-Shirts get 5% discount
131
  * Adidas Special Edition Shoe (A specific product) gets 15% discount for 10 days
132
  * Buy 10 mugs are more and get 5% off – [Video](https://www.youtube.com/watch?v=7ZeRIKXWFmE)
133
+ * Buy 3 for $10, Buy 6 for $20
134
+
135
+ = Fixed Price Per Unit =
136
+
137
+ * Set a fixed price per unit (Product A cost is $20. Buy 5 to 10 quantity for $15 per unit, 11 and above for $10 each)
138
+ * Price can be set for a specific product or variant.
139
+ * If your entire category of products have the same price, you can use this to set a reduced price
140
 
141
  = User Role based Discount =
142
 
143
  * Bulk discount based on user role for specific product or product categories.
144
  * Members of Wholesale customers group gets 40% discount, while Retail customers get 5% discount
145
 
146
+ = Bundle / Package deal =
147
+
148
+ * Create offers like Buy 3 items for $10. 4th item will be charged full price.
149
+ * Repeat the discount easily. Example: Buy 3 for $10, 6 for $20
150
+
151
  = Discount rules activated by coupon =
152
 
153
  * Activate / Trigger a discount rule upon entering a coupon code (useful when you want to provide discount to a target group of users)
172
  * Discount based on the total amount spent by the customer in previous orders
173
  * Discount based on the total number of orders placed by the customer
174
  * Based on purchase history (Example: Provide 10% discount to all customers who purchased Shoes earlier)
175
+ * Purchase history for a specific period (10% discount for those who spent $500 in the last 3 months)
176
 
177
  = Adjustment rules =
178
 
207
  * Cart subtotal
208
  * Line item quantity
209
  * Total cart quantity
210
+ * Purchase history
211
+ * Category
212
+ * User roles
213
+ * Attributes
214
 
215
  = Need assistance with the discount set up? Reach out to us =
216
 
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.
342
+ * Improvement - Survey while deactivate the plugin.
343
+ * Improvement - Moved shipping country option under Customer shipping details in cart rules.
344
+ * Fix - Reduced the priority of the hook woocommerce_get_price_html to 9 as it making conflict with wholesale plugin(sale price adjustment).
345
+ * Fix - Woocommerce Currency Switcher - realmag777 Compatible for you saved text.
346
+
347
  = 1.7.20 - 23/09/19 =
348
  * Feature - Option for Product in list, Exclude product, Exclude on sale product in cart rules.
349
  * Feature - Duration option(Last 7 days, 14 days, 30 days, 60 days, 90 days, 180 days, 1 year, Custom) in purchase history based rules.
view/template/sidebar.php CHANGED
@@ -13,6 +13,27 @@
13
  <span id="sidebar_icon" class="dashicons dashicons-arrow-left"></span>
14
  </div>
15
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  <div class="woo-side-panel">
17
  <?php
18
  echo FlycartWooDiscountRulesGeneralHelper::getSideBarContent();
13
  <span id="sidebar_icon" class="dashicons dashicons-arrow-left"></span>
14
  </div>
15
  </div>
16
+ <div class="woo-side-panel">
17
+ <div class="panel">
18
+ <div class="panel-body">
19
+ <h3><?php esc_html_e('With PRO version, you can create:', 'woo-discount-rules')?></h3>
20
+ <p><?php esc_html_e('- Categories based discounts', 'woo-discount-rules')?></p>
21
+ <p><?php esc_html_e('- User roles based discounts', 'woo-discount-rules')?></p>
22
+ <p><?php esc_html_e('- Buy One Get One Free deals', 'woo-discount-rules')?></p>
23
+ <p><?php esc_html_e('- Buy X Get Y deals', 'woo-discount-rules')?></p>
24
+ <p><?php esc_html_e('- Buy 2, get 1 at 50% discount', 'woo-discount-rules')?></p>
25
+ <p><?php esc_html_e('- Buy 3 for $10 (Package / Bundle [Set] Discount)', 'woo-discount-rules')?></p>
26
+ <p><?php esc_html_e('- Different discounts with one coupon code', 'woo-discount-rules')?></p>
27
+ <p><?php esc_html_e('- Purchase history based discounts', 'woo-discount-rules')?></p>
28
+ <p><?php esc_html_e('- Free product / gift', 'woo-discount-rules')?></p>
29
+ <p><?php esc_html_e('- Discount for variants', 'woo-discount-rules')?></p>
30
+ <p><?php esc_html_e('- Conditional discounts', 'woo-discount-rules')?></p>
31
+ <p><?php esc_html_e('- Fixed cost discounts', 'woo-discount-rules')?></p>
32
+ <p><?php esc_html_e('- Offer fixed price on certain conditions', 'woo-discount-rules')?></p>
33
+ <p><a href="https://www.flycart.org/products/wordpress/woocommerce-discount-rules?utm_source=wpwoodiscountrules&amp;utm_medium=plugin&amp;utm_campaign=inline&amp;utm_content=woo-discount-rules" class="btn btn-success" target="_blank">Go PRO</a></p>
34
+ </div>
35
+ </div>
36
+ </div>
37
  <div class="woo-side-panel">
38
  <?php
39
  echo FlycartWooDiscountRulesGeneralHelper::getSideBarContent();
view/view-cart-rules.php CHANGED
@@ -279,16 +279,6 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
279
  <?php esc_html_e('User role in list', 'woo-discount-rules'); ?>
280
  <?php } ?>
281
  </option>
282
- <option
283
- <?php if (!$pro) { ?> disabled <?php } else { ?> value="shipping_countries_in" <?php
284
- }
285
- if ($type == 'shipping_countries_in') { ?> selected=selected <?php } ?>>
286
- <?php if (!$pro) { ?>
287
- <?php esc_html_e('Shipping country in list', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
288
- <?php } else { ?>
289
- <?php esc_html_e('Shipping country in list', 'woo-discount-rules'); ?>
290
- <?php } ?>
291
- </option>
292
  </optgroup>
293
  <optgroup label="<?php esc_attr_e('Customer Email', 'woo-discount-rules'); ?>">
294
  <option
@@ -325,6 +315,16 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
325
  </option>
326
  </optgroup>
327
  <optgroup label="<?php esc_attr_e('Customer Shipping Details', 'woo-discount-rules'); ?>">
 
 
 
 
 
 
 
 
 
 
328
  <option
329
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_shipping_state" <?php
330
  }
@@ -336,13 +336,13 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
336
  <?php } ?>
337
  </option>
338
  <option
339
- <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_shipping_city" <?php
340
  }
341
- if ($type == 'customer_shipping_city') { ?> selected=selected <?php } ?>>
342
  <?php if (!$pro) { ?>
343
- <?php esc_html_e('Shipping city', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
344
  <?php } else { ?>
345
- <?php esc_html_e('Shipping city', 'woo-discount-rules'); ?>
346
  <?php } ?>
347
  </option>
348
  <option
279
  <?php esc_html_e('User role in list', 'woo-discount-rules'); ?>
280
  <?php } ?>
281
  </option>
 
 
 
 
 
 
 
 
 
 
282
  </optgroup>
283
  <optgroup label="<?php esc_attr_e('Customer Email', 'woo-discount-rules'); ?>">
284
  <option
315
  </option>
316
  </optgroup>
317
  <optgroup label="<?php esc_attr_e('Customer Shipping Details', 'woo-discount-rules'); ?>">
318
+ <option
319
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_shipping_city" <?php
320
+ }
321
+ if ($type == 'customer_shipping_city') { ?> selected=selected <?php } ?>>
322
+ <?php if (!$pro) { ?>
323
+ <?php esc_html_e('Shipping city', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
324
+ <?php } else { ?>
325
+ <?php esc_html_e('Shipping city', 'woo-discount-rules'); ?>
326
+ <?php } ?>
327
+ </option>
328
  <option
329
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_shipping_state" <?php
330
  }
336
  <?php } ?>
337
  </option>
338
  <option
339
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="shipping_countries_in" <?php
340
  }
341
+ if ($type == 'shipping_countries_in') { ?> selected=selected <?php } ?>>
342
  <?php if (!$pro) { ?>
343
+ <?php esc_html_e('Shipping country in list', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
344
  <?php } else { ?>
345
+ <?php esc_html_e('Shipping country in list', 'woo-discount-rules'); ?>
346
  <?php } ?>
347
  </option>
348
  <option
view/view-pricing-rules.php CHANGED
@@ -612,7 +612,7 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
612
  </select>
613
  </div>
614
  <div class="product_based_condition_get_product_discount get_discount_type_product_tag">
615
- <label ><?php esc_html_e('and get discount in ', 'woo-discount-rules') ?></label>
616
  <select class="selectpicker" id="product_based_condition_product_to_apply_count_option" name="product_based_condition[product_to_apply_count_option]">
617
  <option value="all"<?php echo ($product_based_condition_product_to_apply_count_option == 'all')? ' selected="selected"': ''; ?>><?php esc_html_e('All', 'woo-discount-rules') ?></option>
618
  <option value="apply_first"<?php echo ($product_based_condition_product_to_apply_count_option == 'apply_first')? ' selected="selected"': ''; ?>><?php esc_html_e('First quantity(s)', 'woo-discount-rules') ?></option>
@@ -654,6 +654,14 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
654
  <a href=javascript:void(0) class="button button-primary" id="addNewDiscountRange"><i
655
  class="glyphicon glyphicon-plus"></i> <?php esc_html_e('Add New Range', 'woo-discount-rules'); ?></a>
656
  <hr>
 
 
 
 
 
 
 
 
657
  <div id="discount_rule_list">
658
  <?php
659
  $discount_range = array(0 => '');//new stdClass();
@@ -672,14 +680,14 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
672
  ?>
673
  <div class="discount_rule_list">
674
  <div class="form-group">
675
- <label><?php esc_html_e('Min Quantity', 'woo-discount-rules'); ?>
676
  <input type="text"
677
  name="discount_range[<?php echo $fieldIndex; ?>][min_qty]"
678
  class="form-control discount_range_min_qty"
679
  value="<?php echo(isset($discount->min_qty) ? $discount->min_qty : ''); ?>"
680
  placeholder="<?php esc_html_e('ex. 1', 'woo-discount-rules'); ?>">
681
  </label>
682
- <label><?php esc_html_e('Max Quantity', 'woo-discount-rules'); ?>
683
  <input type="text"
684
  name="discount_range[<?php echo $fieldIndex; ?>][max_qty]"
685
  class="form-control discount_range_max_qty"
@@ -704,6 +712,26 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
704
  <?php esc_html_e('Price Discount', 'woo-discount-rules'); ?>
705
  <?php } ?>
706
  </option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
707
  <option
708
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="product_discount" <?php
709
  }
@@ -717,8 +745,6 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
717
  </select></label>
718
  <label>
719
  <span class="price_discount_amount price_discount_amount_tool_tip_con">
720
- <span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="<?php esc_attr_e('Enter only numeric values. Eg: <b>50</b> for 50% discount', 'woo-discount-rules'); ?>"></span>
721
- <span class="woocommerce-help-tip price_discount_amount_tool_tip" data-tip="<?php echo sprintf(esc_attr__('Enter the discount price. Eg: <b>10</b> for %s discount', 'woo-discount-rules'), htmlentities(FlycartWoocommerceProduct::wc_price(10))); ?>"></span>
722
  </span>
723
  </label>
724
  <label><span class="hide-for-product-discount"><?php esc_html_e('Value', 'woo-discount-rules'); ?></span>
@@ -829,6 +855,26 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
829
  </div>
830
  <?php $fieldIndex++; } ?>
831
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
832
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('buy-one-get-one-deals/how-to-create-a-perfect-bogo-discount-rule-in-woocommerce', 'bogo_rules', 'btn btn-info', esc_html__('Guide to create perfect BOGO rules', 'woo-discount-rules')); ?>
833
  </div>
834
  <div class="product_based_discount_cont price_discounts_con">
612
  </select>
613
  </div>
614
  <div class="product_based_condition_get_product_discount get_discount_type_product_tag">
615
+ <label ><?php esc_html_e('and get discount on ', 'woo-discount-rules') ?></label>
616
  <select class="selectpicker" id="product_based_condition_product_to_apply_count_option" name="product_based_condition[product_to_apply_count_option]">
617
  <option value="all"<?php echo ($product_based_condition_product_to_apply_count_option == 'all')? ' selected="selected"': ''; ?>><?php esc_html_e('All', 'woo-discount-rules') ?></option>
618
  <option value="apply_first"<?php echo ($product_based_condition_product_to_apply_count_option == 'apply_first')? ' selected="selected"': ''; ?>><?php esc_html_e('First quantity(s)', 'woo-discount-rules') ?></option>
654
  <a href=javascript:void(0) class="button button-primary" id="addNewDiscountRange"><i
655
  class="glyphicon glyphicon-plus"></i> <?php esc_html_e('Add New Range', 'woo-discount-rules'); ?></a>
656
  <hr>
657
+ <div class="set_discount_with_range_warning">
658
+ <div class="notice inline notice-warning notice-alt">
659
+ <p>
660
+ <?php esc_html_e('Package / bundle deals should NOT be mixed with any other adjustment types when adding ranges. Example: If your first range\'s adjustment type is Package / Bundle deal, other ranges should also be same type.', 'woo-discount-rules'); ?>
661
+ </p>
662
+ </div>
663
+ <br>
664
+ </div>
665
  <div id="discount_rule_list">
666
  <?php
667
  $discount_range = array(0 => '');//new stdClass();
680
  ?>
681
  <div class="discount_rule_list">
682
  <div class="form-group">
683
+ <label><span class="discount_for_min_quantity_text"><?php esc_html_e('Min Quantity', 'woo-discount-rules'); ?></span>
684
  <input type="text"
685
  name="discount_range[<?php echo $fieldIndex; ?>][min_qty]"
686
  class="form-control discount_range_min_qty"
687
  value="<?php echo(isset($discount->min_qty) ? $discount->min_qty : ''); ?>"
688
  placeholder="<?php esc_html_e('ex. 1', 'woo-discount-rules'); ?>">
689
  </label>
690
+ <label class="discount_for_max_quantity_label"><?php esc_html_e('Max Quantity', 'woo-discount-rules'); ?>
691
  <input type="text"
692
  name="discount_range[<?php echo $fieldIndex; ?>][max_qty]"
693
  class="form-control discount_range_max_qty"
712
  <?php esc_html_e('Price Discount', 'woo-discount-rules'); ?>
713
  <?php } ?>
714
  </option>
715
+ <option
716
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="fixed_price" <?php
717
+ }
718
+ if ($opt == 'fixed_price') { ?> selected=selected <?php } ?>>
719
+ <?php if (!$pro) { ?>
720
+ <?php esc_html_e('Fixed Price Per Unit', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
721
+ <?php } else { ?>
722
+ <?php esc_html_e('Fixed Price Per Unit', 'woo-discount-rules'); ?>
723
+ <?php } ?>
724
+ </option>
725
+ <option
726
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="set_discount" <?php
727
+ }
728
+ if ($opt == 'set_discount') { ?> selected=selected <?php } ?>>
729
+ <?php if (!$pro) { ?>
730
+ <?php esc_html_e('Bundle (Set) Discount', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
731
+ <?php } else { ?>
732
+ <?php esc_html_e('Bundle (Set) Discount', 'woo-discount-rules'); ?>
733
+ <?php } ?>
734
+ </option>
735
  <option
736
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="product_discount" <?php
737
  }
745
  </select></label>
746
  <label>
747
  <span class="price_discount_amount price_discount_amount_tool_tip_con">
 
 
748
  </span>
749
  </label>
750
  <label><span class="hide-for-product-discount"><?php esc_html_e('Value', 'woo-discount-rules'); ?></span>
855
  </div>
856
  <?php $fieldIndex++; } ?>
857
  </div>
858
+ <div class="set_discount_info_text">
859
+ <div class="notice inline notice-info notice-alt">
860
+ <p>
861
+ <?php echo __('<b>Example for Bundle (Set) Discount:</b> 3 for $10, 6 for $20<br>So customer can add 3 products / quantities and get them for $10<br><b>NOTE:</b> You will need to enter the entire package / bundle cost. Example: 10 (for the 3 for $10 deal)', 'woo-discount-rules'); ?>
862
+ <br/>
863
+ <a href="<?php echo FlycartWooDiscountRulesGeneralHelper::docsDirectURL('https://docs.flycart.org/en/articles/3197678-buy-3-at-40-set-discount', 'set_discount'); ?>" target="_blank"><?php esc_html_e('Read docs', 'woo-discount-rules'); ?></a>
864
+ </p>
865
+ </div>
866
+ <br>
867
+ </div>
868
+ <div class="fixed_price_discount_info_text">
869
+ <div class="notice inline notice-info notice-alt">
870
+ <p>
871
+ <?php echo __('<b>Example for Fixed Price Per Unit:</b> Product A cost is $20. If customers buy 5 to 10, they can get at $15 each (per unit).<br>Customer adds 6 quantities of Product A. The price per unit will reduce to $15<br><b>NOTE:</b> Enter the Unit price like 15', 'woo-discount-rules'); ?>
872
+ <br/>
873
+ <a href="<?php echo FlycartWooDiscountRulesGeneralHelper::docsDirectURL('https://docs.flycart.org/en/articles/3381529-fixed-price-per-unit', 'fixed_price_per_unit'); ?>" target="_blank"><?php esc_html_e('Read docs', 'woo-discount-rules'); ?></a>
874
+ </p>
875
+ </div>
876
+ <br>
877
+ </div>
878
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('buy-one-get-one-deals/how-to-create-a-perfect-bogo-discount-rule-in-woocommerce', 'bogo_rules', 'btn btn-info', esc_html__('Guide to create perfect BOGO rules', 'woo-discount-rules')); ?>
879
  </div>
880
  <div class="product_based_discount_cont price_discounts_con">
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.7.20
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.0
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/