Discount Rules for WooCommerce - Version 1.9.0

Version Description

  • 17/12/19 =
  • Improvement - Moved BOGO options to adjustment type for user friendly.
  • Improvement - Display time Hours in 24 hours.
  • Improvement - Remove special character for BOGO coupon.
  • Improvement - Load shipping info from session if post value doesn't exists.
  • Improvement - Don't allow to repeat same condition again in cart rule while adding rules.
  • Improvement - To display message on failed to apply coupon when discount applied through Woo Discount plugin(based on settings).
  • Improvement - Event: apply_filters('woo_discount_rules_table_content_condition_html', $condition, $value);
  • Improvement - Event: apply_filters('woo_discount_rules_table_content_discount_html', $discount, $value->discount_type, $value->to_discount, $value);
  • Improvement - Event: apply_filters('woo_discount_rules_exclude_cart_item_which_has_discount_already', false, $cart_item_key, $values, $cart);
  • Improvement - Event: apply_filters('woo_discount_rules_load_coupon_value_by_search', false);
  • Improvement - Event: apply_filters('woo_discount_rules_cart_bogo_coupon_code', '{{product_name}} X {{quantity}}');
  • Improvement - Event: apply_filters('woo_discount_rules_notice_on_remove_coupon_while_having_a_discount', $msg, $code);
  • Improvement - Event: apply_filters('woo_discount_rules_remove_coupon_message_on_apply_discount', true, $coupon_code);
  • Fix - Wrong coupon name while having multiple create coupon option rules is set.
  • Fix - Each category option in cart rule is not working.
  • Fix - Warning due to the method doesn't exists wc_strtoupper.
  • Fix - Changed discount type for free product in cart option.
  • Fix - Free shipping based on shipping state doesn't works when update the cart item.
  • Fix - Warning issue when exclude sale option is enabled in cart rules.
  • Fix - Remove cart rule BOGO when third-party coupon applied(based on settings).
  • Fix - Warning on having first order discount in cart rules.
Download this release

Release Info

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

Code changes from version 1.8.2 to 1.9.0

assets/css/style.css CHANGED
@@ -258,4 +258,13 @@ span.price_discount_amount_tool_tip{
258
  }
259
  select#price_rule_method{
260
  max-width: 100%;
 
 
 
 
 
 
 
 
 
261
  }
258
  }
259
  select#price_rule_method{
260
  max-width: 100%;
261
+ }
262
+ .discount_product_option_hint,
263
+ select.discount_product_option,
264
+ .bogo_receive_discount_for_text,
265
+ .hide_discount_product_item_count_type{
266
+ display: none;
267
+ }
268
+ .wdr_price_rule_listing_table_con{
269
+ padding: 0 15px;
270
  }
assets/js/app.js CHANGED
@@ -31,7 +31,7 @@ function validateWDRBOGOFields(){
31
  if(price_rule_method == 'qty_based'){
32
  jQuery.each( discount_rule_range, function( key, container ) {
33
  var price_discount_type = jQuery(container).find('select.price_discount_type');
34
- if(price_discount_type.val() == 'product_discount'){
35
  var discount_product_option = jQuery(container).find('select.discount_product_option');
36
  if(jQuery.inArray(discount_product_option.val(), ['all', 'same_product']) !== -1){
37
  var discount_bogo_qty = jQuery(container).find('input.discount_bogo_qty');
@@ -339,25 +339,36 @@ function wooo_discount_range_altered() {
339
  }
340
  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>' +
341
  '<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]"> ' +
342
- '<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> ' +
 
 
 
 
 
 
343
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
344
  '</span></label>' +
345
  '<label><span class="hide-for-product-discount">'+woo_discount_localization.value_text+'</span>' +
346
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> ';
347
  form += '<div class="price_discount_product_list_con hide">' +
348
- ' '+woo_discount_localization.apply_for+' <select class="selectpicker discount_product_option" name="discount_range['+count+'][discount_product_option]"><option value="all">'+woo_discount_localization.all_selected+'</option><option value="same_product">'+woo_discount_localization.same_product+'</option>' +
349
  '<option value="more_than_one_cheapest_from_cat">'+woo_discount_localization.more_than_one_cheapest_from_selected_category+'</option><option value="more_than_one_cheapest">'+woo_discount_localization.more_than_one_cheapest_from_selected+'</option><option value="more_than_one_cheapest_from_all">'+woo_discount_localization.more_than_one_cheapest_from_all+'</option>' +
350
  '</select>';
351
- form += '&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_product_option_tooltip+'"></span>';
352
  form += '<div class="discount_product_option_bogo_con">';
353
  form += '&nbsp;<label> '+woo_discount_localization.free_quantity+' <span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.number_of_quantities_in_each_products+'"></span> <input type="text" name="discount_range['+count+'][discount_bogo_qty]" class="form-control discount_bogo_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
354
  form += '</div>';
355
  form += '<div class="discount_product_option_more_cheapest_con hide">';
356
- form += '&nbsp;<select class="selectpicker discount_product_item_count_type" name="discount_range['+count+'][discount_product_item_type]">';
 
 
 
 
 
357
  form += '<option value="dynamic">'+woo_discount_localization.dynamic_item_count+'</option>';
358
  form += '<option value="static">'+woo_discount_localization.fixed_item_count+'</option>';
359
  form += '</select>';
360
- form += '&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.fixed_item_count_tooltip+'"></span>';
361
  form += '&nbsp;<label class="discount_product_items_count_field hide"> '+woo_discount_localization.item_count+'&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_items]" class="form-control discount_product_items_count_field hide" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
362
  form += '&nbsp;<label> '+woo_discount_localization.item_quantity+'&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_each_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_qty]" class="form-control discount_product_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
363
  form += '</div>';
@@ -390,7 +401,13 @@ function wooo_discount_range_altered() {
390
  } else {
391
  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>' +
392
  '<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]"> ' +
393
- '<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>' +
 
 
 
 
 
 
394
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
395
  '</span></label>' +
396
  '<label>'+woo_discount_localization.value_text+' ' +
@@ -870,8 +887,39 @@ function wooo_discount_range_altered() {
870
  var discount_for_max_quantity_label = $(this).closest('.discount_rule_list').find('.discount_for_max_quantity_label');
871
  discount_for_max_quantity_label.show();
872
  discount_for_min_quantity_text.html(woo_discount_localization.min_quantity);
873
- if($(this).val() == 'product_discount'){
874
- discount_amount.hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
875
  price_discount_amount.removeClass('hide').show();
876
  discount_product_percent_con.removeClass('hide').show();
877
  $(this).closest('.discount_rule_list').find('.hide-for-product-discount').hide();
@@ -997,10 +1045,8 @@ function wooo_discount_range_altered() {
997
  resizeChart = setTimeout(function () {
998
  current.val(woo_discount_localization.save_rule);
999
  }, 300);
1000
- console.log(result);
1001
  if(result.create_dynamic_coupon != undefined){
1002
  var error_row_con = $('select.cart_rule_type option[value="create_dynamic_coupon"]:selected');
1003
- console.log(error_row_con);
1004
  error_row_con.closest('.cart_rules_list').find('input.form-control').val(result.create_dynamic_coupon);
1005
  $("input[name='dynamic_coupons_to_apply']").val(result.create_dynamic_coupon);
1006
  }
@@ -1353,13 +1399,29 @@ function wooo_discount_range_altered() {
1353
  });
1354
  $('select.purchased_history_duration').trigger('change');
1355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1356
  $("#cart_rules_list").on('cart_rule_condition_updated', function () {
1357
  var cart_condition_type = $(this).find('select.cart_rule_type');
1358
  var allow_promotion_message, has_subtotal_least, has_quantity_least;
1359
  allow_promotion_message = has_subtotal_least = has_quantity_least = false;
1360
  $(".promotion_subtotal_from_con").hide();
 
1361
  $.each( cart_condition_type, function( key, container ) {
 
1362
  var option_value = $(container).val();
 
1363
  if(option_value == 'subtotal_least'){
1364
  allow_promotion_message = true;
1365
  if(option_value == 'subtotal_least'){
31
  if(price_rule_method == 'qty_based'){
32
  jQuery.each( discount_rule_range, function( key, container ) {
33
  var price_discount_type = jQuery(container).find('select.price_discount_type');
34
+ if(jQuery.inArray(price_discount_type.val(), ['product_discount', 'buy_x_get_x', 'buy_x_get_y', 'more_than_one_cheapest', 'more_than_one_cheapest_from_cat', 'more_than_one_cheapest_from_all']) !== -1){
35
  var discount_product_option = jQuery(container).find('select.discount_product_option');
36
  if(jQuery.inArray(discount_product_option.val(), ['all', 'same_product']) !== -1){
37
  var discount_bogo_qty = jQuery(container).find('input.discount_bogo_qty');
339
  }
340
  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>' +
341
  '<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]"> ' +
342
+ '<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> ' +
343
+ '<option value="buy_x_get_x">'+woo_discount_localization.buy_x_get_x+' </option> ' +
344
+ '<option value="buy_x_get_y">'+woo_discount_localization.buy_x_get_y+' </option> ' +
345
+ '<option value="more_than_one_cheapest">'+woo_discount_localization.more_than_one_cheapest_from_selected+' </option> ' +
346
+ '<option value="more_than_one_cheapest_from_cat">'+woo_discount_localization.more_than_one_cheapest_from_selected_category+' </option> ' +
347
+ '<option value="more_than_one_cheapest_from_all">'+woo_discount_localization.more_than_one_cheapest_from_all+' </option> ' +
348
+ '</select></label> ' +
349
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
350
  '</span></label>' +
351
  '<label><span class="hide-for-product-discount">'+woo_discount_localization.value_text+'</span>' +
352
  '<input type="text" name="discount_range[' + count + '][to_discount]" class="form-control price_discount_amount" value="" placeholder="'+woo_discount_localization.place_holder_ex_50+'"> ';
353
  form += '<div class="price_discount_product_list_con hide">' +
354
+ '<span class="bogo_receive_discount_for_text"> '+woo_discount_localization.apply_for+' </span><select class="discount_product_option" name="discount_range['+count+'][discount_product_option]"><option value="all">'+woo_discount_localization.all_selected+'</option><option value="same_product">'+woo_discount_localization.same_product+'</option>' +
355
  '<option value="more_than_one_cheapest_from_cat">'+woo_discount_localization.more_than_one_cheapest_from_selected_category+'</option><option value="more_than_one_cheapest">'+woo_discount_localization.more_than_one_cheapest_from_selected+'</option><option value="more_than_one_cheapest_from_all">'+woo_discount_localization.more_than_one_cheapest_from_all+'</option>' +
356
  '</select>';
357
+ form += '&nbsp;<span class="woocommerce-help-tip discount_product_option_hint" data-tip="'+woo_discount_localization.discount_product_option_tooltip+'"></span>';
358
  form += '<div class="discount_product_option_bogo_con">';
359
  form += '&nbsp;<label> '+woo_discount_localization.free_quantity+' <span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.number_of_quantities_in_each_products+'"></span> <input type="text" name="discount_range['+count+'][discount_bogo_qty]" class="form-control discount_bogo_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
360
  form += '</div>';
361
  form += '<div class="discount_product_option_more_cheapest_con hide">';
362
+ var discount_product_item_count_type_class = ' selectpicker';
363
+ var discount_product_item_count_type_hint_class = '';
364
+ if(woo_discount_localization.enable_fixed_item_count_in_bogo == false){
365
+ discount_product_item_count_type_hint_class = discount_product_item_count_type_class = ' hide_discount_product_item_count_type';
366
+ }
367
+ form += '&nbsp;<select class="discount_product_item_count_type'+discount_product_item_count_type_class+'" name="discount_range['+count+'][discount_product_item_type]">';
368
  form += '<option value="dynamic">'+woo_discount_localization.dynamic_item_count+'</option>';
369
  form += '<option value="static">'+woo_discount_localization.fixed_item_count+'</option>';
370
  form += '</select>';
371
+ form += '&nbsp;<span class="woocommerce-help-tip'+discount_product_item_count_type_hint_class+'" data-tip="'+woo_discount_localization.fixed_item_count_tooltip+'"></span>';
372
  form += '&nbsp;<label class="discount_product_items_count_field hide"> '+woo_discount_localization.item_count+'&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_items]" class="form-control discount_product_items_count_field hide" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
373
  form += '&nbsp;<label> '+woo_discount_localization.item_quantity+'&nbsp;<span class="woocommerce-help-tip" data-tip="'+woo_discount_localization.discount_number_of_each_item_tooltip+'"></span><input type="text" name="discount_range['+count+'][discount_product_qty]" class="form-control discount_product_qty" value="" placeholder="'+woo_discount_localization.place_holder_ex_1+'" /></label>';
374
  form += '</div>';
401
  } else {
402
  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>' +
403
  '<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]"> ' +
404
+ '<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> ' +
405
+ '<option disabled>'+woo_discount_localization.buy_x_get_x+' <b>' + pro_suffix + '</b> </option> ' +
406
+ '<option disabled>'+woo_discount_localization.buy_x_get_y+' <b>' + pro_suffix + '</b> </option> ' +
407
+ '<option disabled>'+woo_discount_localization.more_than_one_cheapest_from_selected+' <b>' + pro_suffix + '</b> </option> ' +
408
+ '<option disabled>'+woo_discount_localization.more_than_one_cheapest_from_selected_category+' <b>' + pro_suffix + '</b> </option> ' +
409
+ '<option disabled>'+woo_discount_localization.more_than_one_cheapest_from_all+' <b>' + pro_suffix + '</b> </option> ' +
410
+ '</select></label>' +
411
  '<label><span class="price_discount_amount price_discount_amount_tool_tip_con">\n' +
412
  '</span></label>' +
413
  '<label>'+woo_discount_localization.value_text+' ' +
887
  var discount_for_max_quantity_label = $(this).closest('.discount_rule_list').find('.discount_for_max_quantity_label');
888
  discount_for_max_quantity_label.show();
889
  discount_for_min_quantity_text.html(woo_discount_localization.min_quantity);
890
+ if(jQuery.inArray($(this).val(), ['product_discount', 'buy_x_get_x', 'buy_x_get_y', 'more_than_one_cheapest', 'more_than_one_cheapest_from_cat', 'more_than_one_cheapest_from_all']) !== -1){
891
+ if(jQuery.inArray($(this).val(), ['buy_x_get_x', 'buy_x_get_y', 'more_than_one_cheapest', 'more_than_one_cheapest_from_cat', 'more_than_one_cheapest_from_all']) !== -1){
892
+ var discount_product_option_field = $(this).closest('.discount_rule_list').find('.discount_product_option');
893
+ if($(this).val() == 'buy_x_get_x'){
894
+ $(discount_product_option_field).val('same_product');
895
+ } else if($(this).val() == 'buy_x_get_y'){
896
+ $(discount_product_option_field).val('all');
897
+ } else {
898
+ $(discount_product_option_field).val($(this).val());
899
+ if(woo_discount_localization.enable_fixed_item_count_in_bogo == false){
900
+ var discount_product_item_count_type_field = $(this).closest('.discount_rule_list').find('.discount_product_item_count_type');
901
+ $(discount_product_item_count_type_field).val('dynamic');
902
+ $(discount_product_item_count_type_field).trigger('change');
903
+ }
904
+ }
905
+ $(discount_product_option_field).trigger('change');
906
+ discount_amount.hide();
907
+ var discount_type_tool_tip_con = $(this).closest('.discount_rule_list').find('.price_discount_amount_tool_tip_con');
908
+ var adjustment_tool_tip_text = '';
909
+ if($(this).val() == 'buy_x_get_x'){
910
+ adjustment_tool_tip_text = woo_discount_localization.buy_x_get_x_tool_tip_text;
911
+ } else if($(this).val() == 'buy_x_get_y'){
912
+ adjustment_tool_tip_text = woo_discount_localization.buy_x_get_y_tool_tip_text;
913
+ } else if($(this).val() == 'more_than_one_cheapest'){
914
+ adjustment_tool_tip_text = woo_discount_localization.more_than_one_cheapest_tool_tip_text;
915
+ } else if($(this).val() == 'more_than_one_cheapest_from_cat'){
916
+ adjustment_tool_tip_text = woo_discount_localization.more_than_one_cheapest_from_cat_tool_tip_text;
917
+ } else if($(this).val() == 'more_than_one_cheapest_from_all'){
918
+ adjustment_tool_tip_text = woo_discount_localization.more_than_one_cheapest_from_all_tool_tip_text;
919
+ }
920
+ discount_type_tool_tip_con.html('<span class="woocommerce-help-tip percentage_discount_amount_tool_tip" data-tip="'+adjustment_tool_tip_text+'"></span>').show();
921
+ trigger_woocommerce_tooltip();
922
+ }
923
  price_discount_amount.removeClass('hide').show();
924
  discount_product_percent_con.removeClass('hide').show();
925
  $(this).closest('.discount_rule_list').find('.hide-for-product-discount').hide();
1045
  resizeChart = setTimeout(function () {
1046
  current.val(woo_discount_localization.save_rule);
1047
  }, 300);
 
1048
  if(result.create_dynamic_coupon != undefined){
1049
  var error_row_con = $('select.cart_rule_type option[value="create_dynamic_coupon"]:selected');
 
1050
  error_row_con.closest('.cart_rules_list').find('input.form-control').val(result.create_dynamic_coupon);
1051
  $("input[name='dynamic_coupons_to_apply']").val(result.create_dynamic_coupon);
1052
  }
1399
  });
1400
  $('select.purchased_history_duration').trigger('change');
1401
 
1402
+ function woo_discount_disable_cart_condition_options(field, disable_values) {
1403
+ var selected_value = $(field).val();
1404
+ $(field).find("option[wdr_altered='1']").removeAttr("disabled");
1405
+ if(disable_values.length){
1406
+ $.each( disable_values, function( key, value ) {
1407
+ $(field).find("option[value='"+value+"']").attr("disabled", "disabled").attr("wdr_altered", "1");
1408
+ });
1409
+ if(jQuery.inArray(selected_value, disable_values) !== -1){
1410
+ $(field).find('option:enabled').eq(0).prop('selected',true).trigger("change");
1411
+ }
1412
+ }
1413
+ }
1414
+
1415
  $("#cart_rules_list").on('cart_rule_condition_updated', function () {
1416
  var cart_condition_type = $(this).find('select.cart_rule_type');
1417
  var allow_promotion_message, has_subtotal_least, has_quantity_least;
1418
  allow_promotion_message = has_subtotal_least = has_quantity_least = false;
1419
  $(".promotion_subtotal_from_con").hide();
1420
+ var used_conditions = [];
1421
  $.each( cart_condition_type, function( key, container ) {
1422
+ woo_discount_disable_cart_condition_options(container, used_conditions);
1423
  var option_value = $(container).val();
1424
+ used_conditions.push(option_value);
1425
  if(option_value == 'subtotal_least'){
1426
  allow_promotion_message = true;
1427
  if(option_value == 'subtotal_least'){
helper/general-helper.php CHANGED
@@ -654,9 +654,9 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
654
  $string .= " - <span class='wdr_status_active_text text-success'>(".esc_html__('Running', 'woo-discount-rules').")</span>";
655
  } else {
656
  $current_date_and_time = self::getCurrentDateAndTimeBasedOnTimeZone();
657
- $current_date_and_time = date('m/d/Y h:i', strtotime($current_date_and_time));
658
  $string .= " - <span class='wdr_status_active_text'>(".$validate_date_string.")</span>";
659
- $string .= "<br><span class='wdr_status_active_text text-warning'><b>".esc_html__('Your server current date and time: ', 'woo-discount-rules').": </b>".$current_date_and_time."</span>";
660
  }
661
 
662
  return $string;
@@ -1067,7 +1067,7 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
1067
  $coupon_name = trim($coupon_name);
1068
  $coupon_name = str_replace(' ', '', $coupon_name);
1069
  $coupon_name = apply_filters('woocommerce_coupon_code', $coupon_name);
1070
- $coupon_name = wc_strtoupper($coupon_name);
1071
 
1072
  return $coupon_name;
1073
  }
@@ -1083,7 +1083,7 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
1083
  {
1084
  if(is_string($coupon_data)){
1085
  $used_coupon_codes = self::getDynamicUsedCouponsInRules();
1086
- if (in_array(wc_strtoupper($coupon_data), $used_coupon_codes)) {
1087
  $discount_type = 'percent';
1088
  $amount = 0;
1089
 
654
  $string .= " - <span class='wdr_status_active_text text-success'>(".esc_html__('Running', 'woo-discount-rules').")</span>";
655
  } else {
656
  $current_date_and_time = self::getCurrentDateAndTimeBasedOnTimeZone();
657
+ $current_date_and_time = date('m/d/Y H:i', strtotime($current_date_and_time));
658
  $string .= " - <span class='wdr_status_active_text'>(".$validate_date_string.")</span>";
659
+ $string .= "<br><span class='wdr_status_active_text text-warning'><b>".esc_html__('Your server current date and time: ', 'woo-discount-rules')." </b>".$current_date_and_time."</span>";
660
  }
661
 
662
  return $string;
1067
  $coupon_name = trim($coupon_name);
1068
  $coupon_name = str_replace(' ', '', $coupon_name);
1069
  $coupon_name = apply_filters('woocommerce_coupon_code', $coupon_name);
1070
+ $coupon_name = FlycartWoocommerceProduct::wc_strtoupper($coupon_name);
1071
 
1072
  return $coupon_name;
1073
  }
1083
  {
1084
  if(is_string($coupon_data)){
1085
  $used_coupon_codes = self::getDynamicUsedCouponsInRules();
1086
+ if (in_array(FlycartWoocommerceProduct::wc_strtoupper($coupon_data), $used_coupon_codes)) {
1087
  $discount_type = 'percent';
1088
  $amount = 0;
1089
 
helper/woo-function.php CHANGED
@@ -71,6 +71,20 @@ if(!class_exists('FlycartWoocommerceProduct')){
71
  return self::$products[$product_id];
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  /**
75
  * Get WooCommerce product format name
76
  *
71
  return self::$products[$product_id];
72
  }
73
 
74
+ /**
75
+ * String to upper
76
+ *
77
+ * @param $string string
78
+ * @return string
79
+ * */
80
+ public static function wc_strtoupper($string){
81
+ if(function_exists('')){
82
+ return wc_strtoupper($string);
83
+ } else {
84
+ return strtoupper($string);
85
+ }
86
+ }
87
+
88
  /**
89
  * Get WooCommerce product format name
90
  *
i18n/languages/woo-discount-rules.pot CHANGED
@@ -108,11 +108,11 @@ msgstr ""
108
  msgid "License key seems to be Invalid. Please enter a valid license key"
109
  msgstr ""
110
 
111
- #: helper/woo-function.php:471 helper/woo-function.php:481
112
  msgid "Search for a product&hellip;"
113
  msgstr ""
114
 
115
- #: helper/woo-function.php:514 helper/woo-function.php:526
116
  msgid "Search for a user&hellip;"
117
  msgstr ""
118
 
@@ -130,7 +130,7 @@ msgid "Free Shipping"
130
  msgstr ""
131
 
132
  #: includes/advanced/free_shipping_method.php:73
133
- #: includes/discount-base.php:1050 view/cart-rules.php:133
134
  #: view/pricing-rules.php:163 view/settings_promotion.php:65
135
  #: view/settings_promotion.php:100
136
  msgid "Enable"
@@ -148,526 +148,528 @@ msgstr ""
148
  msgid "Title to be display on site"
149
  msgstr ""
150
 
151
- #: includes/cart-rules.php:113 includes/pricing-rules.php:120
152
  msgid "Saved successfully"
153
  msgstr ""
154
 
155
- #: includes/cart-rules.php:164 includes/pricing-rules.php:153
156
  msgid "Failed to save"
157
  msgstr ""
158
 
159
- #: includes/discount-base.php:195 view/cart-rules.php:147
160
- #: view/pricing-rules.php:177
161
  msgid "Active"
162
  msgstr ""
163
 
164
- #: includes/discount-base.php:197 view/cart-rules.php:149
165
- #: view/pricing-rules.php:179 view/settings_cart_rules.php:95
166
  #: view/settings_cart_rules.php:102 view/settings_price_rules.php:169
167
  #: view/settings_promotion.php:22 view/settings_promotion.php:62
168
  #: view/settings_promotion.php:97 view/settings_promotion.php:132
169
  msgid "Disabled"
170
  msgstr ""
171
 
172
- #: includes/discount-base.php:509
173
  msgid "Cache cleared successfully"
174
  msgstr ""
175
 
176
- #: includes/discount-base.php:511
177
  msgid "Failed to clear cache"
178
  msgstr ""
179
 
180
- #: includes/discount-base.php:622 includes/discount-base.php:657
181
  msgid "Failed to do action"
182
  msgstr ""
183
 
184
- #: includes/discount-base.php:661
185
  msgid "Disabled successfully"
186
  msgstr ""
187
 
188
- #: includes/discount-base.php:664
189
  msgid "Deleted successfully"
190
  msgstr ""
191
 
192
- #: includes/discount-base.php:667
193
  msgid "Enabled successfully"
194
  msgstr ""
195
 
196
- #: includes/discount-base.php:687 includes/discount-base.php:688
197
- #: includes/discount-base.php:705
198
  msgid "copy"
199
  msgstr ""
200
 
201
- #: includes/discount-base.php:713
202
  msgid "Duplicate rule created successfully"
203
  msgstr ""
204
 
205
- #: includes/discount-base.php:717
206
  msgid "Failed to create duplicate rule"
207
  msgstr ""
208
 
209
- #: includes/discount-base.php:1004
210
  msgid "Please fill this field"
211
  msgstr ""
212
 
213
- #: includes/discount-base.php:1005
214
  msgid "Please Enter the Rule Name to Create / Save."
215
  msgstr ""
216
 
217
- #: includes/discount-base.php:1006
218
  msgid "Saving..."
219
  msgstr ""
220
 
221
- #: includes/discount-base.php:1007 view/view-cart-rules.php:55
222
  #: view/view-pricing-rules.php:37
223
  msgid "Save Rule"
224
  msgstr ""
225
 
226
- #: includes/discount-base.php:1008
227
  msgid "Please enter a Key"
228
  msgstr ""
229
 
230
- #: includes/discount-base.php:1009 view/view-pricing-rules.php:698
231
  msgid "Min Quantity"
232
  msgstr ""
233
 
234
- #: includes/discount-base.php:1010 view/view-pricing-rules.php:705
235
  msgid "Max Quantity"
236
  msgstr ""
237
 
238
- #: includes/discount-base.php:1011 view/view-pricing-rules.php:613
239
  #: view/view-pricing-rules.php:616 view/view-pricing-rules.php:636
240
  msgid "Quantity"
241
  msgstr ""
242
 
243
- #: includes/discount-base.php:1012 view/view-cart-rules.php:92
244
  #: view/view-pricing-rules.php:74 view/view-pricing-rules.php:703
245
- #: view/view-pricing-rules.php:802 view/view-pricing-rules.php:819
246
- #: view/view-pricing-rules.php:826
247
  msgid "ex. 1"
248
  msgstr ""
249
 
250
- #: includes/discount-base.php:1013 view/view-pricing-rules.php:864
251
  msgid "ex. 10"
252
  msgstr ""
253
 
254
- #: includes/discount-base.php:1014 view/view-pricing-rules.php:710
255
- #: view/view-pricing-rules.php:770
256
  msgid "ex. 50"
257
  msgstr ""
258
 
259
- #: includes/discount-base.php:1015
260
  msgid "Search for a user"
261
  msgstr ""
262
 
263
- #: includes/discount-base.php:1016 view/view-pricing-rules.php:711
264
  msgid "Adjustment Type"
265
  msgstr ""
266
 
267
- #: includes/discount-base.php:1017 view/view-pricing-rules.php:853
268
  msgid "Discount percentage"
269
  msgstr ""
270
 
271
- #: includes/discount-base.php:1018 view/view-cart-rules.php:776
272
  #: view/view-pricing-rules.php:717
273
  msgid "Percentage Discount"
274
  msgstr ""
275
 
276
- #: includes/discount-base.php:1019 view/view-cart-rules.php:782
277
  #: view/view-cart-rules.php:784 view/view-pricing-rules.php:725
278
  #: view/view-pricing-rules.php:727
279
  msgid "Price Discount"
280
  msgstr ""
281
 
282
- #: includes/discount-base.php:1020 view/view-pricing-rules.php:755
283
- #: view/view-pricing-rules.php:757
284
  msgid "BOGO Product Discount"
285
  msgstr ""
286
 
287
- #: includes/discount-base.php:1021
288
  msgid "Product Discount - Not support for subtotal based rule"
289
  msgstr ""
290
 
291
- #: includes/discount-base.php:1022 view/view-cart-rules.php:462
292
- #: view/view-pricing-rules.php:765 view/view-pricing-rules.php:913
293
  msgid "Value"
294
  msgstr ""
295
 
296
- #: includes/discount-base.php:1023 view/view-pricing-rules.php:787
297
  msgid "receive discount for"
298
  msgstr ""
299
 
300
- #: includes/discount-base.php:1024 view/view-pricing-rules.php:789
301
  msgid "Auto add all selected products"
302
  msgstr ""
303
 
304
- #: includes/discount-base.php:1025 view/view-pricing-rules.php:790
305
  msgid "Same product"
306
  msgstr ""
307
 
308
- #: includes/discount-base.php:1026
309
  msgid "Any one cheapest from selected"
310
  msgstr ""
311
 
312
- #: includes/discount-base.php:1027
313
  msgid "Any one cheapest from all products"
314
  msgstr ""
315
 
316
- #: includes/discount-base.php:1028 view/view-pricing-rules.php:791
 
317
  msgid "Cheapest in cart - selected category(ies)"
318
  msgstr ""
319
 
320
- #: includes/discount-base.php:1029 view/view-pricing-rules.php:792
 
321
  msgid "Cheapest in cart - selected item(s)"
322
  msgstr ""
323
 
324
- #: includes/discount-base.php:1030 view/view-pricing-rules.php:793
 
325
  msgid "Cheapest among all items in cart"
326
  msgstr ""
327
 
328
- #: includes/discount-base.php:1031 view/view-pricing-rules.php:797
329
  msgid "Free quantity"
330
  msgstr ""
331
 
332
- #: includes/discount-base.php:1032 view/view-pricing-rules.php:797
333
  msgid "Number of quantity(ies) in each selected product(s)"
334
  msgstr ""
335
 
336
- #: includes/discount-base.php:1033 view/view-pricing-rules.php:811
337
  msgid "Fixed item count (not recommended)"
338
  msgstr ""
339
 
340
- #: includes/discount-base.php:1034 view/view-pricing-rules.php:810
341
  msgid "Dynamic item count"
342
  msgstr ""
343
 
344
- #: includes/discount-base.php:1035 view/view-pricing-rules.php:813
345
  msgid ""
346
  "Fixed item count - You need to provide item count manually. Dynamic item "
347
  "count - System will choose dynamically based on cart"
348
  msgstr ""
349
 
350
- #: includes/discount-base.php:1036 view/view-pricing-rules.php:814
351
  msgid "Item count"
352
  msgstr ""
353
 
354
- #: includes/discount-base.php:1037 view/view-pricing-rules.php:814
355
  msgid "Discount for number of item(s) in cart"
356
  msgstr ""
357
 
358
- #: includes/discount-base.php:1038 view/view-pricing-rules.php:821
359
  msgid "Discount for number of quantity(ies)"
360
  msgstr ""
361
 
362
- #: includes/discount-base.php:1039 view/view-pricing-rules.php:821
363
  msgid "Item quantity"
364
  msgstr ""
365
 
366
- #: includes/discount-base.php:1040
367
  msgid "Search for a products"
368
  msgstr ""
369
 
370
- #: includes/discount-base.php:1041
371
  msgid "and"
372
  msgstr ""
373
 
374
- #: includes/discount-base.php:1042 view/view-pricing-rules.php:855
375
  msgid "100% percent"
376
  msgstr ""
377
 
378
- #: includes/discount-base.php:1043 view/view-pricing-rules.php:856
379
  msgid "Limited percent"
380
  msgstr ""
381
 
382
- #: includes/discount-base.php:1044
383
  msgid "Percentage"
384
  msgstr ""
385
 
386
- #: includes/discount-base.php:1045
387
  msgid "as discount"
388
  msgstr ""
389
 
390
- #: includes/discount-base.php:1046 view/view-cart-rules.php:701
391
- #: view/view-pricing-rules.php:870
392
  msgid "Remove"
393
  msgstr ""
394
 
395
- #: includes/discount-base.php:1047 view/cart-rules.php:170
396
- #: view/pricing-rules.php:200 view/view-pricing-rules.php:873
397
  msgid "Duplicate"
398
  msgstr ""
399
 
400
- #: includes/discount-base.php:1048
401
  msgid "none"
402
  msgstr ""
403
 
404
- #: includes/discount-base.php:1049
405
  msgid "Are you sure to remove this ?"
406
  msgstr ""
407
 
408
- #: includes/discount-base.php:1051 view/cart-rules.php:130
409
  #: view/pricing-rules.php:160
410
  msgid "Disable"
411
  msgstr ""
412
 
413
- #: includes/discount-base.php:1052
414
  msgid "Are you sure to remove ?"
415
  msgstr ""
416
 
417
- #: includes/discount-base.php:1053 view/view-cart-rules.php:172
418
  msgid "Type"
419
  msgstr ""
420
 
421
- #: includes/discount-base.php:1054 view/view-cart-rules.php:176
422
  msgid "Cart Subtotal"
423
  msgstr ""
424
 
425
- #: includes/discount-base.php:1055 view/view-cart-rules.php:179
426
  msgid "Subtotal at least"
427
  msgstr ""
428
 
429
- #: includes/discount-base.php:1056 view/view-cart-rules.php:183
430
  msgid "Subtotal less than"
431
  msgstr ""
432
 
433
- #: includes/discount-base.php:1057 view/view-cart-rules.php:186
434
  msgid "Cart Item Count"
435
  msgstr ""
436
 
437
- #: includes/discount-base.php:1058 view/view-cart-rules.php:189
438
  msgid "Number of line items in the cart (not quantity) at least"
439
  msgstr ""
440
 
441
- #: includes/discount-base.php:1059 view/view-cart-rules.php:193
442
  msgid "Number of line items in the cart (not quantity) less than"
443
  msgstr ""
444
 
445
- #: includes/discount-base.php:1060 view/view-cart-rules.php:196
446
  msgid "Quantity Sum"
447
  msgstr ""
448
 
449
- #: includes/discount-base.php:1061 view/view-cart-rules.php:202
450
  #: view/view-cart-rules.php:205
451
  msgid "Total number of quantities in the cart at least"
452
  msgstr ""
453
 
454
- #: includes/discount-base.php:1062 view/view-cart-rules.php:214
455
  #: view/view-cart-rules.php:217
456
  msgid "Total number of quantities in the cart less than"
457
  msgstr ""
458
 
459
- #: includes/discount-base.php:1063 view/view-cart-rules.php:246
460
  msgid "Categories in cart"
461
  msgstr ""
462
 
463
- #: includes/discount-base.php:1064 view/view-cart-rules.php:252
464
  msgid "Including sub-categories in cart"
465
  msgstr ""
466
 
467
- #: includes/discount-base.php:1065 view/view-cart-rules.php:267
468
  msgid "Customer Details (must be logged in)"
469
  msgstr ""
470
 
471
- #: includes/discount-base.php:1066 view/view-cart-rules.php:273
472
  #: view/view-cart-rules.php:275
473
  msgid "User in list"
474
  msgstr ""
475
 
476
- #: includes/discount-base.php:1067 view/view-cart-rules.php:283
477
  #: view/view-cart-rules.php:285
478
  msgid "User role in list"
479
  msgstr ""
480
 
481
- #: includes/discount-base.php:1068 view/view-cart-rules.php:349
482
  #: view/view-cart-rules.php:351
483
  msgid "Shipping country in list"
484
  msgstr ""
485
 
486
- #: includes/discount-base.php:1069 view/view-cart-rules.php:289
487
  msgid "Customer Email"
488
  msgstr ""
489
 
490
- #: includes/discount-base.php:1070
491
  msgid "Email with TLD (Ege: edu)"
492
  msgstr ""
493
 
494
- #: includes/discount-base.php:1071 view/view-cart-rules.php:305
495
  #: view/view-cart-rules.php:307
496
  msgid "Email with Domain (Eg: gmail.com)"
497
  msgstr ""
498
 
499
- #: includes/discount-base.php:1072 view/view-cart-rules.php:311
500
  msgid "Customer Billing Details"
501
  msgstr ""
502
 
503
- #: includes/discount-base.php:1073 view/view-cart-rules.php:317
504
  #: view/view-cart-rules.php:319
505
  msgid "Billing city"
506
  msgstr ""
507
 
508
- #: includes/discount-base.php:1074 view/view-cart-rules.php:323
509
  msgid "Customer Shipping Details"
510
  msgstr ""
511
 
512
- #: includes/discount-base.php:1075 view/view-cart-rules.php:339
513
  #: view/view-cart-rules.php:341
514
  msgid "Shipping state"
515
  msgstr ""
516
 
517
- #: includes/discount-base.php:1076 view/view-cart-rules.php:329
518
  #: view/view-cart-rules.php:331
519
  msgid "Shipping city"
520
  msgstr ""
521
 
522
- #: includes/discount-base.php:1077 view/view-cart-rules.php:359
523
  #: view/view-cart-rules.php:361
524
  msgid "Shipping zip code"
525
  msgstr ""
526
 
527
- #: includes/discount-base.php:1078 view/view-cart-rules.php:365
528
  #: view/view-pricing-rules.php:500
529
  msgid "Purchase History"
530
  msgstr ""
531
 
532
- #: includes/discount-base.php:1079 view/view-cart-rules.php:381
533
  #: view/view-cart-rules.php:383 view/view-pricing-rules.php:509
534
  msgid "Purchased amount"
535
  msgstr ""
536
 
537
- #: includes/discount-base.php:1080 view/view-cart-rules.php:391
538
  #: view/view-cart-rules.php:393 view/view-pricing-rules.php:510
539
  msgid "Number of previous orders made"
540
  msgstr ""
541
 
542
- #: includes/discount-base.php:1081 view/view-cart-rules.php:401
543
  #: view/view-cart-rules.php:403 view/view-pricing-rules.php:511
544
  msgid "Number of previous orders made with following products"
545
  msgstr ""
546
 
547
- #: includes/discount-base.php:1082 view/view-cart-rules.php:411
548
  #: view/view-cart-rules.php:413 view/view-pricing-rules.php:512
549
  msgid "Number of quantity(s) in previous orders made with following products"
550
  msgstr ""
551
 
552
- #: includes/discount-base.php:1083 view/view-cart-rules.php:417
553
  msgid "Coupon applied"
554
  msgstr ""
555
 
556
- #: includes/discount-base.php:1084 view/view-cart-rules.php:423
557
  #: view/view-cart-rules.php:425 view/view-pricing-rules.php:378
558
  msgid "Create your own coupon"
559
  msgstr ""
560
 
561
- #: includes/discount-base.php:1085 view/view-cart-rules.php:433
562
  #: view/view-cart-rules.php:435
563
  msgid "Atleast any one (Select from WooCommerce)"
564
  msgstr ""
565
 
566
- #: includes/discount-base.php:1086 view/view-cart-rules.php:443
567
  #: view/view-cart-rules.php:445
568
  msgid "All selected (Select from WooCommerce)"
569
  msgstr ""
570
 
571
- #: includes/discount-base.php:1087 view/view-cart-rules.php:647
572
  #: view/view-pricing-rules.php:549
573
  msgid "Greater than or equal to"
574
  msgstr ""
575
 
576
- #: includes/discount-base.php:1088 view/view-cart-rules.php:648
577
  #: view/view-pricing-rules.php:550 view/view-pricing-rules.php:609
578
  msgid "Less than or equal to"
579
  msgstr ""
580
 
581
- #: includes/discount-base.php:1089 view/view-cart-rules.php:650
582
  #: view/view-pricing-rules.php:553
583
  msgid "and the order status should be"
584
  msgstr ""
585
 
586
- #: includes/discount-base.php:1090 view/cart-rules.php:114
587
- #: view/cart-rules.php:209 view/pricing-rules.php:144
588
- #: view/pricing-rules.php:239 view/view-cart-rules.php:700
589
  msgid "Action"
590
  msgstr ""
591
 
592
- #: includes/discount-base.php:1091 view/settings.php:33
593
  #: view/settings_taxonomy.php:21
594
  msgid "Save"
595
  msgstr ""
596
 
597
- #: includes/discount-base.php:1092
598
  msgid "Saved Successfully!"
599
  msgstr ""
600
 
601
- #: includes/discount-base.php:1093 view/view-cart-rules.php:491
602
  #: view/view-cart-rules.php:559 view/view-cart-rules.php:579
603
  #: view/view-cart-rules.php:600 view/view-cart-rules.php:655
604
  #: view/view-pricing-rules.php:235 view/view-pricing-rules.php:251
605
  #: view/view-pricing-rules.php:561 view/view-pricing-rules.php:645
606
- #: view/view-pricing-rules.php:841
607
  msgid "None selected"
608
  msgstr ""
609
 
610
- #: includes/discount-base.php:1094 view/view-cart-rules.php:258
611
  msgid "In each category"
612
  msgstr ""
613
 
614
- #: includes/discount-base.php:1095 view/settings_price_rules.php:208
615
  #: view/settings_price_rules.php:226 view/settings_price_rules.php:244
616
  #: view/settings_price_rules.php:262
617
  msgid "Show"
618
  msgstr ""
619
 
620
- #: includes/discount-base.php:1096 view/template/sidebar.php:12
621
  msgid "Hide"
622
  msgstr ""
623
 
624
- #: includes/discount-base.php:1097
625
  msgid "Please select at least one rule"
626
  msgstr ""
627
 
628
- #: includes/discount-base.php:1098
629
  msgid "Please select an action to apply"
630
  msgstr ""
631
 
632
- #: includes/discount-base.php:1099
633
  msgid "Are you sure to remove the selected rules"
634
  msgstr ""
635
 
636
- #: includes/discount-base.php:1100 view/view-pricing-rules.php:830
637
  msgid "Choose product(s)"
638
  msgstr ""
639
 
640
- #: includes/discount-base.php:1101 view/view-pricing-rules.php:840
641
  msgid "Choose category(ies)"
642
  msgstr ""
643
 
644
- #: includes/discount-base.php:1102
645
  msgid "Search for a coupon"
646
  msgstr ""
647
 
648
- #: includes/discount-base.php:1103 view/view-pricing-rules.php:864
649
  #, php-format
650
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
651
  msgstr ""
652
 
653
- #: includes/discount-base.php:1104
654
  #, php-format
655
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
656
  msgstr ""
657
 
658
- #: includes/discount-base.php:1105
659
  #, php-format
660
  msgid "Enter the discounted price per unit. Eg: <b>10</b> for %s as unit price"
661
  msgstr ""
662
 
663
- #: includes/discount-base.php:1106
664
  #, php-format
665
  msgid ""
666
  "Enter the price for selected quantity. Eg: <b>10</b> then %s as total price "
667
  "for selected quantity"
668
  msgstr ""
669
 
670
- #: includes/discount-base.php:1107 view/view-pricing-rules.php:795
671
  msgid ""
672
  "Auto add all selected products - Automatically added to the cart <br> Same "
673
  "product - get discount in same product <br> Any one cheapest from selected - "
@@ -678,195 +680,248 @@ msgid ""
678
  "no.of quantities"
679
  msgstr ""
680
 
681
- #: includes/discount-base.php:1108 view/view-cart-rules.php:221
682
  msgid "Products"
683
  msgstr ""
684
 
685
- #: includes/discount-base.php:1109 view/view-cart-rules.php:226
686
  msgid "Products in cart"
687
  msgstr ""
688
 
689
- #: includes/discount-base.php:1110 view/view-cart-rules.php:232
690
  #: view/view-pricing-rules.php:270
691
  msgid "Exclude products"
692
  msgstr ""
693
 
694
- #: includes/discount-base.php:1111 view/view-cart-rules.php:238
695
  msgid "Exclude on sale products"
696
  msgstr ""
697
 
698
- #: includes/discount-base.php:1112 view/view-cart-rules.php:529
699
  msgid "This will exclude the on sale products from discount"
700
  msgstr ""
701
 
702
- #: includes/discount-base.php:1113 view/view-cart-rules.php:663
703
  #: view/view-pricing-rules.php:568
704
  msgid "From all previous orders"
705
  msgstr ""
706
 
707
- #: includes/discount-base.php:1114 view/view-cart-rules.php:664
708
  #: view/view-pricing-rules.php:569
709
  msgid "Last 7 days"
710
  msgstr ""
711
 
712
- #: includes/discount-base.php:1115 view/view-cart-rules.php:665
713
  #: view/view-pricing-rules.php:570
714
  msgid "Last 14 days"
715
  msgstr ""
716
 
717
- #: includes/discount-base.php:1116 view/view-cart-rules.php:666
718
  #: view/view-pricing-rules.php:571
719
  msgid "Last 30 days"
720
  msgstr ""
721
 
722
- #: includes/discount-base.php:1117 view/view-cart-rules.php:667
723
  #: view/view-pricing-rules.php:572
724
  msgid "Last 60 days"
725
  msgstr ""
726
 
727
- #: includes/discount-base.php:1118 view/view-cart-rules.php:668
728
  #: view/view-pricing-rules.php:573
729
  msgid "Last 90 days"
730
  msgstr ""
731
 
732
- #: includes/discount-base.php:1119 view/view-cart-rules.php:669
733
  #: view/view-pricing-rules.php:574
734
  msgid "Last 180 days"
735
  msgstr ""
736
 
737
- #: includes/discount-base.php:1120 view/view-cart-rules.php:670
738
  #: view/view-pricing-rules.php:575
739
  msgid "Last 1 year"
740
  msgstr ""
741
 
742
- #: includes/discount-base.php:1121 view/view-cart-rules.php:671
743
  #: view/view-pricing-rules.php:576
744
  msgid "Custom"
745
  msgstr ""
746
 
747
- #: includes/discount-base.php:1122 view/view-cart-rules.php:674
748
  #: view/view-pricing-rules.php:580
749
  msgid "in days"
750
  msgstr ""
751
 
752
- #: includes/discount-base.php:1123 view/view-pricing-rules.php:735
753
  #: view/view-pricing-rules.php:737
754
  msgid "Fixed Price Per Unit"
755
  msgstr ""
756
 
757
- #: includes/discount-base.php:1124 view/view-pricing-rules.php:745
758
  #: view/view-pricing-rules.php:747
759
  msgid "Bundle (Set) Discount"
760
  msgstr ""
761
 
762
- #: includes/discount-base.php:1125 view/view-cart-rules.php:371
763
  #: view/view-cart-rules.php:373 view/view-pricing-rules.php:508
764
  msgid "First Order discount"
765
  msgstr ""
766
 
767
- #: includes/discount-base.php:1126 view/view-cart-rules.php:264
768
  msgid "Exclude categories in cart"
769
  msgstr ""
770
 
771
- #: includes/discount-base.php:1207 view/includes/menu.php:13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
  msgid "Settings"
773
  msgstr ""
774
 
775
- #: includes/pricing-rules.php:3158 view/view-pricing-rules.php:601
776
  msgid "Buy"
777
  msgstr ""
778
 
779
- #: includes/pricing-rules.php:3162
780
  msgid " less than or equal to "
781
  msgstr ""
782
 
783
- #: includes/pricing-rules.php:3162 includes/pricing-rules.php:3168
784
  msgid " Quantity"
785
  msgstr ""
786
 
787
- #: includes/pricing-rules.php:3165
788
  msgid " Quantity "
789
  msgstr ""
790
 
791
- #: includes/pricing-rules.php:3172
792
  msgid " or more Quantity"
793
  msgstr ""
794
 
795
- #: includes/pricing-rules.php:3181
796
  msgid " any "
797
  msgstr ""
798
 
799
- #: includes/pricing-rules.php:3181
800
  msgid " products from "
801
  msgstr ""
802
 
803
- #: includes/pricing-rules.php:3188
804
  msgid " in each products"
805
  msgstr ""
806
 
807
- #: includes/pricing-rules.php:3200
808
  msgid " and get discount on "
809
  msgstr ""
810
 
811
- #: includes/pricing-rules.php:3203
812
  msgid " first "
813
  msgstr ""
814
 
815
- #: includes/pricing-rules.php:3205 includes/pricing-rules.php:3209
816
  msgid " quantity of product(s) - "
817
  msgstr ""
818
 
819
- #: includes/pricing-rules.php:3207
820
  msgid " after first "
821
  msgstr ""
822
 
823
- #: includes/pricing-rules.php:3225
824
  msgid "Category(ies) "
825
  msgstr ""
826
 
827
- #: includes/pricing-rules.php:3296
828
  msgid "Get "
829
  msgstr ""
830
 
831
- #: includes/pricing-rules.php:3298
832
  #, php-format
833
  msgid "% discount in "
834
  msgstr ""
835
 
836
- #: includes/pricing-rules.php:3301
837
  msgid "same product"
838
  msgstr ""
839
 
840
- #: includes/pricing-rules.php:3303
841
  msgid "any cheapest one from cart"
842
  msgstr ""
843
 
844
- #: includes/pricing-rules.php:3306
845
  msgid "any cheapest one of "
846
  msgstr ""
847
 
848
- #: includes/pricing-rules.php:3311
849
  msgid " quantity of any "
850
  msgstr ""
851
 
852
- #: includes/pricing-rules.php:3313
853
  msgid " cheapest item "
854
  msgstr ""
855
 
856
- #: includes/pricing-rules.php:3316
857
  msgid " quantity of cheapest item "
858
  msgstr ""
859
 
860
- #: includes/pricing-rules.php:3320
861
  msgid "from the category "
862
  msgstr ""
863
 
864
- #: includes/pricing-rules.php:3342
865
  #, php-format
866
  msgid "%s for %s Quantity(s)"
867
  msgstr ""
868
 
869
- #: includes/pricing-rules.php:3344
870
  #, php-format
871
  msgid "%s as price per unit"
872
  msgstr ""
@@ -988,41 +1043,41 @@ msgstr ""
988
  msgid "Apply"
989
  msgstr ""
990
 
991
- #: view/cart-rules.php:98 view/cart-rules.php:193 view/pricing-rules.php:128
992
- #: view/pricing-rules.php:223 view/template/discount-table.php:36
993
  msgid "Name"
994
  msgstr ""
995
 
996
- #: view/cart-rules.php:99 view/cart-rules.php:194 view/pricing-rules.php:129
997
- #: view/pricing-rules.php:224
998
  msgid "Start Date"
999
  msgstr ""
1000
 
1001
- #: view/cart-rules.php:100 view/cart-rules.php:195 view/pricing-rules.php:130
1002
- #: view/pricing-rules.php:225
1003
  msgid "Expired On"
1004
  msgstr ""
1005
 
1006
- #: view/cart-rules.php:101 view/cart-rules.php:196 view/pricing-rules.php:131
1007
- #: view/pricing-rules.php:226
1008
  msgid "Status"
1009
  msgstr ""
1010
 
1011
- #: view/cart-rules.php:104 view/cart-rules.php:199 view/pricing-rules.php:134
1012
- #: view/pricing-rules.php:229
1013
  msgid "Language"
1014
  msgstr ""
1015
 
1016
- #: view/cart-rules.php:109 view/cart-rules.php:204 view/pricing-rules.php:139
1017
- #: view/pricing-rules.php:234
1018
  msgid "Order"
1019
  msgstr ""
1020
 
1021
- #: view/cart-rules.php:166 view/pricing-rules.php:196
1022
  msgid "Edit"
1023
  msgstr ""
1024
 
1025
- #: view/cart-rules.php:177 view/pricing-rules.php:207
1026
  msgid "Delete"
1027
  msgstr ""
1028
 
@@ -1844,7 +1899,7 @@ msgid "<b>Eg:</b> Spend {{difference_amount}} more and get 10% discount"
1844
  msgstr ""
1845
 
1846
  #: view/view-cart-rules.php:749 view/view-cart-rules.php:846
1847
- #: view/view-pricing-rules.php:659 view/view-pricing-rules.php:918
1848
  msgid "Previous"
1849
  msgstr ""
1850
 
@@ -2131,7 +2186,7 @@ msgid ""
2131
  "(Set) Discount, other ranges should also be same type."
2132
  msgstr ""
2133
 
2134
- #: view/view-pricing-rules.php:884
2135
  msgid ""
2136
  "<b>Example for Bundle (Set) Discount:</b> 3 for $10, 6 for $20<br>So "
2137
  "customer can add 3 products / quantities and get them for $10<br><b>NOTE:</"
@@ -2139,11 +2194,11 @@ msgid ""
2139
  "the 3 for $10 deal)"
2140
  msgstr ""
2141
 
2142
- #: view/view-pricing-rules.php:886 view/view-pricing-rules.php:896
2143
  msgid "Read docs"
2144
  msgstr ""
2145
 
2146
- #: view/view-pricing-rules.php:894
2147
  msgid ""
2148
  "<b>Example for Fixed Price Per Unit:</b> Product A cost is $20. If customers "
2149
  "buy 5 to 10, they can get at $15 each (per unit).<br>Customer adds 6 "
@@ -2151,14 +2206,14 @@ msgid ""
2151
  "b> Enter the Unit price like 15"
2152
  msgstr ""
2153
 
2154
- #: view/view-pricing-rules.php:901
2155
  msgid "Guide to create perfect BOGO rules"
2156
  msgstr ""
2157
 
2158
- #: view/view-pricing-rules.php:911
2159
  msgid "Percent"
2160
  msgstr ""
2161
 
2162
- #: view/view-pricing-rules.php:912
2163
  msgid "Fixed"
2164
  msgstr ""
108
  msgid "License key seems to be Invalid. Please enter a valid license key"
109
  msgstr ""
110
 
111
+ #: helper/woo-function.php:485 helper/woo-function.php:495
112
  msgid "Search for a product&hellip;"
113
  msgstr ""
114
 
115
+ #: helper/woo-function.php:528 helper/woo-function.php:540
116
  msgid "Search for a user&hellip;"
117
  msgstr ""
118
 
130
  msgstr ""
131
 
132
  #: includes/advanced/free_shipping_method.php:73
133
+ #: includes/discount-base.php:1055 view/cart-rules.php:133
134
  #: view/pricing-rules.php:163 view/settings_promotion.php:65
135
  #: view/settings_promotion.php:100
136
  msgid "Enable"
148
  msgid "Title to be display on site"
149
  msgstr ""
150
 
151
+ #: includes/cart-rules.php:115 includes/pricing-rules.php:120
152
  msgid "Saved successfully"
153
  msgstr ""
154
 
155
+ #: includes/cart-rules.php:184 includes/pricing-rules.php:153
156
  msgid "Failed to save"
157
  msgstr ""
158
 
159
+ #: includes/discount-base.php:195 view/cart-rules.php:162
160
+ #: view/pricing-rules.php:192
161
  msgid "Active"
162
  msgstr ""
163
 
164
+ #: includes/discount-base.php:197 view/cart-rules.php:164
165
+ #: view/pricing-rules.php:194 view/settings_cart_rules.php:95
166
  #: view/settings_cart_rules.php:102 view/settings_price_rules.php:169
167
  #: view/settings_promotion.php:22 view/settings_promotion.php:62
168
  #: view/settings_promotion.php:97 view/settings_promotion.php:132
169
  msgid "Disabled"
170
  msgstr ""
171
 
172
+ #: includes/discount-base.php:514
173
  msgid "Cache cleared successfully"
174
  msgstr ""
175
 
176
+ #: includes/discount-base.php:516
177
  msgid "Failed to clear cache"
178
  msgstr ""
179
 
180
+ #: includes/discount-base.php:627 includes/discount-base.php:662
181
  msgid "Failed to do action"
182
  msgstr ""
183
 
184
+ #: includes/discount-base.php:666
185
  msgid "Disabled successfully"
186
  msgstr ""
187
 
188
+ #: includes/discount-base.php:669
189
  msgid "Deleted successfully"
190
  msgstr ""
191
 
192
+ #: includes/discount-base.php:672
193
  msgid "Enabled successfully"
194
  msgstr ""
195
 
196
+ #: includes/discount-base.php:692 includes/discount-base.php:693
197
+ #: includes/discount-base.php:710
198
  msgid "copy"
199
  msgstr ""
200
 
201
+ #: includes/discount-base.php:718
202
  msgid "Duplicate rule created successfully"
203
  msgstr ""
204
 
205
+ #: includes/discount-base.php:722
206
  msgid "Failed to create duplicate rule"
207
  msgstr ""
208
 
209
+ #: includes/discount-base.php:1009
210
  msgid "Please fill this field"
211
  msgstr ""
212
 
213
+ #: includes/discount-base.php:1010
214
  msgid "Please Enter the Rule Name to Create / Save."
215
  msgstr ""
216
 
217
+ #: includes/discount-base.php:1011
218
  msgid "Saving..."
219
  msgstr ""
220
 
221
+ #: includes/discount-base.php:1012 view/view-cart-rules.php:55
222
  #: view/view-pricing-rules.php:37
223
  msgid "Save Rule"
224
  msgstr ""
225
 
226
+ #: includes/discount-base.php:1013
227
  msgid "Please enter a Key"
228
  msgstr ""
229
 
230
+ #: includes/discount-base.php:1014 view/view-pricing-rules.php:698
231
  msgid "Min Quantity"
232
  msgstr ""
233
 
234
+ #: includes/discount-base.php:1015 view/view-pricing-rules.php:705
235
  msgid "Max Quantity"
236
  msgstr ""
237
 
238
+ #: includes/discount-base.php:1016 view/view-pricing-rules.php:613
239
  #: view/view-pricing-rules.php:616 view/view-pricing-rules.php:636
240
  msgid "Quantity"
241
  msgstr ""
242
 
243
+ #: includes/discount-base.php:1017 view/view-cart-rules.php:92
244
  #: view/view-pricing-rules.php:74 view/view-pricing-rules.php:703
245
+ #: view/view-pricing-rules.php:842 view/view-pricing-rules.php:865
246
+ #: view/view-pricing-rules.php:872
247
  msgid "ex. 1"
248
  msgstr ""
249
 
250
+ #: includes/discount-base.php:1018 view/view-pricing-rules.php:910
251
  msgid "ex. 10"
252
  msgstr ""
253
 
254
+ #: includes/discount-base.php:1019 view/view-pricing-rules.php:710
255
+ #: view/view-pricing-rules.php:810
256
  msgid "ex. 50"
257
  msgstr ""
258
 
259
+ #: includes/discount-base.php:1020
260
  msgid "Search for a user"
261
  msgstr ""
262
 
263
+ #: includes/discount-base.php:1021 view/view-pricing-rules.php:711
264
  msgid "Adjustment Type"
265
  msgstr ""
266
 
267
+ #: includes/discount-base.php:1022 view/view-pricing-rules.php:899
268
  msgid "Discount percentage"
269
  msgstr ""
270
 
271
+ #: includes/discount-base.php:1023 view/view-cart-rules.php:776
272
  #: view/view-pricing-rules.php:717
273
  msgid "Percentage Discount"
274
  msgstr ""
275
 
276
+ #: includes/discount-base.php:1024 view/view-cart-rules.php:782
277
  #: view/view-cart-rules.php:784 view/view-pricing-rules.php:725
278
  #: view/view-pricing-rules.php:727
279
  msgid "Price Discount"
280
  msgstr ""
281
 
282
+ #: includes/discount-base.php:1025
 
283
  msgid "BOGO Product Discount"
284
  msgstr ""
285
 
286
+ #: includes/discount-base.php:1026
287
  msgid "Product Discount - Not support for subtotal based rule"
288
  msgstr ""
289
 
290
+ #: includes/discount-base.php:1027 view/view-cart-rules.php:462
291
+ #: view/view-pricing-rules.php:805 view/view-pricing-rules.php:959
292
  msgid "Value"
293
  msgstr ""
294
 
295
+ #: includes/discount-base.php:1028 view/view-pricing-rules.php:827
296
  msgid "receive discount for"
297
  msgstr ""
298
 
299
+ #: includes/discount-base.php:1029 view/view-pricing-rules.php:829
300
  msgid "Auto add all selected products"
301
  msgstr ""
302
 
303
+ #: includes/discount-base.php:1030 view/view-pricing-rules.php:830
304
  msgid "Same product"
305
  msgstr ""
306
 
307
+ #: includes/discount-base.php:1031
308
  msgid "Any one cheapest from selected"
309
  msgstr ""
310
 
311
+ #: includes/discount-base.php:1032
312
  msgid "Any one cheapest from all products"
313
  msgstr ""
314
 
315
+ #: includes/discount-base.php:1033 view/view-pricing-rules.php:785
316
+ #: view/view-pricing-rules.php:787 view/view-pricing-rules.php:831
317
  msgid "Cheapest in cart - selected category(ies)"
318
  msgstr ""
319
 
320
+ #: includes/discount-base.php:1034 view/view-pricing-rules.php:775
321
+ #: view/view-pricing-rules.php:777 view/view-pricing-rules.php:832
322
  msgid "Cheapest in cart - selected item(s)"
323
  msgstr ""
324
 
325
+ #: includes/discount-base.php:1035 view/view-pricing-rules.php:795
326
+ #: view/view-pricing-rules.php:797 view/view-pricing-rules.php:833
327
  msgid "Cheapest among all items in cart"
328
  msgstr ""
329
 
330
+ #: includes/discount-base.php:1036 view/view-pricing-rules.php:837
331
  msgid "Free quantity"
332
  msgstr ""
333
 
334
+ #: includes/discount-base.php:1037 view/view-pricing-rules.php:837
335
  msgid "Number of quantity(ies) in each selected product(s)"
336
  msgstr ""
337
 
338
+ #: includes/discount-base.php:1038 view/view-pricing-rules.php:857
339
  msgid "Fixed item count (not recommended)"
340
  msgstr ""
341
 
342
+ #: includes/discount-base.php:1039 view/view-pricing-rules.php:856
343
  msgid "Dynamic item count"
344
  msgstr ""
345
 
346
+ #: includes/discount-base.php:1040 view/view-pricing-rules.php:859
347
  msgid ""
348
  "Fixed item count - You need to provide item count manually. Dynamic item "
349
  "count - System will choose dynamically based on cart"
350
  msgstr ""
351
 
352
+ #: includes/discount-base.php:1041 view/view-pricing-rules.php:860
353
  msgid "Item count"
354
  msgstr ""
355
 
356
+ #: includes/discount-base.php:1042 view/view-pricing-rules.php:860
357
  msgid "Discount for number of item(s) in cart"
358
  msgstr ""
359
 
360
+ #: includes/discount-base.php:1043 view/view-pricing-rules.php:867
361
  msgid "Discount for number of quantity(ies)"
362
  msgstr ""
363
 
364
+ #: includes/discount-base.php:1044 view/view-pricing-rules.php:867
365
  msgid "Item quantity"
366
  msgstr ""
367
 
368
+ #: includes/discount-base.php:1045
369
  msgid "Search for a products"
370
  msgstr ""
371
 
372
+ #: includes/discount-base.php:1046
373
  msgid "and"
374
  msgstr ""
375
 
376
+ #: includes/discount-base.php:1047 view/view-pricing-rules.php:901
377
  msgid "100% percent"
378
  msgstr ""
379
 
380
+ #: includes/discount-base.php:1048 view/view-pricing-rules.php:902
381
  msgid "Limited percent"
382
  msgstr ""
383
 
384
+ #: includes/discount-base.php:1049
385
  msgid "Percentage"
386
  msgstr ""
387
 
388
+ #: includes/discount-base.php:1050
389
  msgid "as discount"
390
  msgstr ""
391
 
392
+ #: includes/discount-base.php:1051 view/view-cart-rules.php:701
393
+ #: view/view-pricing-rules.php:916
394
  msgid "Remove"
395
  msgstr ""
396
 
397
+ #: includes/discount-base.php:1052 view/cart-rules.php:185
398
+ #: view/pricing-rules.php:215 view/view-pricing-rules.php:919
399
  msgid "Duplicate"
400
  msgstr ""
401
 
402
+ #: includes/discount-base.php:1053
403
  msgid "none"
404
  msgstr ""
405
 
406
+ #: includes/discount-base.php:1054
407
  msgid "Are you sure to remove this ?"
408
  msgstr ""
409
 
410
+ #: includes/discount-base.php:1056 view/cart-rules.php:130
411
  #: view/pricing-rules.php:160
412
  msgid "Disable"
413
  msgstr ""
414
 
415
+ #: includes/discount-base.php:1057
416
  msgid "Are you sure to remove ?"
417
  msgstr ""
418
 
419
+ #: includes/discount-base.php:1058 view/view-cart-rules.php:172
420
  msgid "Type"
421
  msgstr ""
422
 
423
+ #: includes/discount-base.php:1059 view/view-cart-rules.php:176
424
  msgid "Cart Subtotal"
425
  msgstr ""
426
 
427
+ #: includes/discount-base.php:1060 view/view-cart-rules.php:179
428
  msgid "Subtotal at least"
429
  msgstr ""
430
 
431
+ #: includes/discount-base.php:1061 view/view-cart-rules.php:183
432
  msgid "Subtotal less than"
433
  msgstr ""
434
 
435
+ #: includes/discount-base.php:1062 view/view-cart-rules.php:186
436
  msgid "Cart Item Count"
437
  msgstr ""
438
 
439
+ #: includes/discount-base.php:1063 view/view-cart-rules.php:189
440
  msgid "Number of line items in the cart (not quantity) at least"
441
  msgstr ""
442
 
443
+ #: includes/discount-base.php:1064 view/view-cart-rules.php:193
444
  msgid "Number of line items in the cart (not quantity) less than"
445
  msgstr ""
446
 
447
+ #: includes/discount-base.php:1065 view/view-cart-rules.php:196
448
  msgid "Quantity Sum"
449
  msgstr ""
450
 
451
+ #: includes/discount-base.php:1066 view/view-cart-rules.php:202
452
  #: view/view-cart-rules.php:205
453
  msgid "Total number of quantities in the cart at least"
454
  msgstr ""
455
 
456
+ #: includes/discount-base.php:1067 view/view-cart-rules.php:214
457
  #: view/view-cart-rules.php:217
458
  msgid "Total number of quantities in the cart less than"
459
  msgstr ""
460
 
461
+ #: includes/discount-base.php:1068 view/view-cart-rules.php:246
462
  msgid "Categories in cart"
463
  msgstr ""
464
 
465
+ #: includes/discount-base.php:1069 view/view-cart-rules.php:252
466
  msgid "Including sub-categories in cart"
467
  msgstr ""
468
 
469
+ #: includes/discount-base.php:1070 view/view-cart-rules.php:267
470
  msgid "Customer Details (must be logged in)"
471
  msgstr ""
472
 
473
+ #: includes/discount-base.php:1071 view/view-cart-rules.php:273
474
  #: view/view-cart-rules.php:275
475
  msgid "User in list"
476
  msgstr ""
477
 
478
+ #: includes/discount-base.php:1072 view/view-cart-rules.php:283
479
  #: view/view-cart-rules.php:285
480
  msgid "User role in list"
481
  msgstr ""
482
 
483
+ #: includes/discount-base.php:1073 view/view-cart-rules.php:349
484
  #: view/view-cart-rules.php:351
485
  msgid "Shipping country in list"
486
  msgstr ""
487
 
488
+ #: includes/discount-base.php:1074 view/view-cart-rules.php:289
489
  msgid "Customer Email"
490
  msgstr ""
491
 
492
+ #: includes/discount-base.php:1075
493
  msgid "Email with TLD (Ege: edu)"
494
  msgstr ""
495
 
496
+ #: includes/discount-base.php:1076 view/view-cart-rules.php:305
497
  #: view/view-cart-rules.php:307
498
  msgid "Email with Domain (Eg: gmail.com)"
499
  msgstr ""
500
 
501
+ #: includes/discount-base.php:1077 view/view-cart-rules.php:311
502
  msgid "Customer Billing Details"
503
  msgstr ""
504
 
505
+ #: includes/discount-base.php:1078 view/view-cart-rules.php:317
506
  #: view/view-cart-rules.php:319
507
  msgid "Billing city"
508
  msgstr ""
509
 
510
+ #: includes/discount-base.php:1079 view/view-cart-rules.php:323
511
  msgid "Customer Shipping Details"
512
  msgstr ""
513
 
514
+ #: includes/discount-base.php:1080 view/view-cart-rules.php:339
515
  #: view/view-cart-rules.php:341
516
  msgid "Shipping state"
517
  msgstr ""
518
 
519
+ #: includes/discount-base.php:1081 view/view-cart-rules.php:329
520
  #: view/view-cart-rules.php:331
521
  msgid "Shipping city"
522
  msgstr ""
523
 
524
+ #: includes/discount-base.php:1082 view/view-cart-rules.php:359
525
  #: view/view-cart-rules.php:361
526
  msgid "Shipping zip code"
527
  msgstr ""
528
 
529
+ #: includes/discount-base.php:1083 view/view-cart-rules.php:365
530
  #: view/view-pricing-rules.php:500
531
  msgid "Purchase History"
532
  msgstr ""
533
 
534
+ #: includes/discount-base.php:1084 view/view-cart-rules.php:381
535
  #: view/view-cart-rules.php:383 view/view-pricing-rules.php:509
536
  msgid "Purchased amount"
537
  msgstr ""
538
 
539
+ #: includes/discount-base.php:1085 view/view-cart-rules.php:391
540
  #: view/view-cart-rules.php:393 view/view-pricing-rules.php:510
541
  msgid "Number of previous orders made"
542
  msgstr ""
543
 
544
+ #: includes/discount-base.php:1086 view/view-cart-rules.php:401
545
  #: view/view-cart-rules.php:403 view/view-pricing-rules.php:511
546
  msgid "Number of previous orders made with following products"
547
  msgstr ""
548
 
549
+ #: includes/discount-base.php:1087 view/view-cart-rules.php:411
550
  #: view/view-cart-rules.php:413 view/view-pricing-rules.php:512
551
  msgid "Number of quantity(s) in previous orders made with following products"
552
  msgstr ""
553
 
554
+ #: includes/discount-base.php:1088 view/view-cart-rules.php:417
555
  msgid "Coupon applied"
556
  msgstr ""
557
 
558
+ #: includes/discount-base.php:1089 view/view-cart-rules.php:423
559
  #: view/view-cart-rules.php:425 view/view-pricing-rules.php:378
560
  msgid "Create your own coupon"
561
  msgstr ""
562
 
563
+ #: includes/discount-base.php:1090 view/view-cart-rules.php:433
564
  #: view/view-cart-rules.php:435
565
  msgid "Atleast any one (Select from WooCommerce)"
566
  msgstr ""
567
 
568
+ #: includes/discount-base.php:1091 view/view-cart-rules.php:443
569
  #: view/view-cart-rules.php:445
570
  msgid "All selected (Select from WooCommerce)"
571
  msgstr ""
572
 
573
+ #: includes/discount-base.php:1092 view/view-cart-rules.php:647
574
  #: view/view-pricing-rules.php:549
575
  msgid "Greater than or equal to"
576
  msgstr ""
577
 
578
+ #: includes/discount-base.php:1093 view/view-cart-rules.php:648
579
  #: view/view-pricing-rules.php:550 view/view-pricing-rules.php:609
580
  msgid "Less than or equal to"
581
  msgstr ""
582
 
583
+ #: includes/discount-base.php:1094 view/view-cart-rules.php:650
584
  #: view/view-pricing-rules.php:553
585
  msgid "and the order status should be"
586
  msgstr ""
587
 
588
+ #: includes/discount-base.php:1095 view/cart-rules.php:114
589
+ #: view/cart-rules.php:224 view/pricing-rules.php:144
590
+ #: view/pricing-rules.php:254 view/view-cart-rules.php:700
591
  msgid "Action"
592
  msgstr ""
593
 
594
+ #: includes/discount-base.php:1096 view/settings.php:33
595
  #: view/settings_taxonomy.php:21
596
  msgid "Save"
597
  msgstr ""
598
 
599
+ #: includes/discount-base.php:1097
600
  msgid "Saved Successfully!"
601
  msgstr ""
602
 
603
+ #: includes/discount-base.php:1098 view/view-cart-rules.php:491
604
  #: view/view-cart-rules.php:559 view/view-cart-rules.php:579
605
  #: view/view-cart-rules.php:600 view/view-cart-rules.php:655
606
  #: view/view-pricing-rules.php:235 view/view-pricing-rules.php:251
607
  #: view/view-pricing-rules.php:561 view/view-pricing-rules.php:645
608
+ #: view/view-pricing-rules.php:887
609
  msgid "None selected"
610
  msgstr ""
611
 
612
+ #: includes/discount-base.php:1099 view/view-cart-rules.php:258
613
  msgid "In each category"
614
  msgstr ""
615
 
616
+ #: includes/discount-base.php:1100 view/settings_price_rules.php:208
617
  #: view/settings_price_rules.php:226 view/settings_price_rules.php:244
618
  #: view/settings_price_rules.php:262
619
  msgid "Show"
620
  msgstr ""
621
 
622
+ #: includes/discount-base.php:1101 view/template/sidebar.php:12
623
  msgid "Hide"
624
  msgstr ""
625
 
626
+ #: includes/discount-base.php:1102
627
  msgid "Please select at least one rule"
628
  msgstr ""
629
 
630
+ #: includes/discount-base.php:1103
631
  msgid "Please select an action to apply"
632
  msgstr ""
633
 
634
+ #: includes/discount-base.php:1104
635
  msgid "Are you sure to remove the selected rules"
636
  msgstr ""
637
 
638
+ #: includes/discount-base.php:1105 view/view-pricing-rules.php:876
639
  msgid "Choose product(s)"
640
  msgstr ""
641
 
642
+ #: includes/discount-base.php:1106 view/view-pricing-rules.php:886
643
  msgid "Choose category(ies)"
644
  msgstr ""
645
 
646
+ #: includes/discount-base.php:1107
647
  msgid "Search for a coupon"
648
  msgstr ""
649
 
650
+ #: includes/discount-base.php:1108 view/view-pricing-rules.php:910
651
  #, php-format
652
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
653
  msgstr ""
654
 
655
+ #: includes/discount-base.php:1109
656
  #, php-format
657
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
658
  msgstr ""
659
 
660
+ #: includes/discount-base.php:1110
661
  #, php-format
662
  msgid "Enter the discounted price per unit. Eg: <b>10</b> for %s as unit price"
663
  msgstr ""
664
 
665
+ #: includes/discount-base.php:1111
666
  #, php-format
667
  msgid ""
668
  "Enter the price for selected quantity. Eg: <b>10</b> then %s as total price "
669
  "for selected quantity"
670
  msgstr ""
671
 
672
+ #: includes/discount-base.php:1112 view/view-pricing-rules.php:835
673
  msgid ""
674
  "Auto add all selected products - Automatically added to the cart <br> Same "
675
  "product - get discount in same product <br> Any one cheapest from selected - "
680
  "no.of quantities"
681
  msgstr ""
682
 
683
+ #: includes/discount-base.php:1113 view/view-cart-rules.php:221
684
  msgid "Products"
685
  msgstr ""
686
 
687
+ #: includes/discount-base.php:1114 view/view-cart-rules.php:226
688
  msgid "Products in cart"
689
  msgstr ""
690
 
691
+ #: includes/discount-base.php:1115 view/view-cart-rules.php:232
692
  #: view/view-pricing-rules.php:270
693
  msgid "Exclude products"
694
  msgstr ""
695
 
696
+ #: includes/discount-base.php:1116 view/view-cart-rules.php:238
697
  msgid "Exclude on sale products"
698
  msgstr ""
699
 
700
+ #: includes/discount-base.php:1117 view/view-cart-rules.php:529
701
  msgid "This will exclude the on sale products from discount"
702
  msgstr ""
703
 
704
+ #: includes/discount-base.php:1118 view/view-cart-rules.php:663
705
  #: view/view-pricing-rules.php:568
706
  msgid "From all previous orders"
707
  msgstr ""
708
 
709
+ #: includes/discount-base.php:1119 view/view-cart-rules.php:664
710
  #: view/view-pricing-rules.php:569
711
  msgid "Last 7 days"
712
  msgstr ""
713
 
714
+ #: includes/discount-base.php:1120 view/view-cart-rules.php:665
715
  #: view/view-pricing-rules.php:570
716
  msgid "Last 14 days"
717
  msgstr ""
718
 
719
+ #: includes/discount-base.php:1121 view/view-cart-rules.php:666
720
  #: view/view-pricing-rules.php:571
721
  msgid "Last 30 days"
722
  msgstr ""
723
 
724
+ #: includes/discount-base.php:1122 view/view-cart-rules.php:667
725
  #: view/view-pricing-rules.php:572
726
  msgid "Last 60 days"
727
  msgstr ""
728
 
729
+ #: includes/discount-base.php:1123 view/view-cart-rules.php:668
730
  #: view/view-pricing-rules.php:573
731
  msgid "Last 90 days"
732
  msgstr ""
733
 
734
+ #: includes/discount-base.php:1124 view/view-cart-rules.php:669
735
  #: view/view-pricing-rules.php:574
736
  msgid "Last 180 days"
737
  msgstr ""
738
 
739
+ #: includes/discount-base.php:1125 view/view-cart-rules.php:670
740
  #: view/view-pricing-rules.php:575
741
  msgid "Last 1 year"
742
  msgstr ""
743
 
744
+ #: includes/discount-base.php:1126 view/view-cart-rules.php:671
745
  #: view/view-pricing-rules.php:576
746
  msgid "Custom"
747
  msgstr ""
748
 
749
+ #: includes/discount-base.php:1127 view/view-cart-rules.php:674
750
  #: view/view-pricing-rules.php:580
751
  msgid "in days"
752
  msgstr ""
753
 
754
+ #: includes/discount-base.php:1128 view/view-pricing-rules.php:735
755
  #: view/view-pricing-rules.php:737
756
  msgid "Fixed Price Per Unit"
757
  msgstr ""
758
 
759
+ #: includes/discount-base.php:1129 view/view-pricing-rules.php:745
760
  #: view/view-pricing-rules.php:747
761
  msgid "Bundle (Set) Discount"
762
  msgstr ""
763
 
764
+ #: includes/discount-base.php:1130 view/view-cart-rules.php:371
765
  #: view/view-cart-rules.php:373 view/view-pricing-rules.php:508
766
  msgid "First Order discount"
767
  msgstr ""
768
 
769
+ #: includes/discount-base.php:1131 view/view-cart-rules.php:264
770
  msgid "Exclude categories in cart"
771
  msgstr ""
772
 
773
+ #: includes/discount-base.php:1133 view/view-pricing-rules.php:755
774
+ #: view/view-pricing-rules.php:757
775
+ msgid "Buy X get X (Same product)"
776
+ msgstr ""
777
+
778
+ #: includes/discount-base.php:1134 view/view-pricing-rules.php:765
779
+ #: view/view-pricing-rules.php:767
780
+ msgid "Buy X get Y (Auto add all selected products)"
781
+ msgstr ""
782
+
783
+ #: includes/discount-base.php:1135
784
+ #, php-format
785
+ msgid ""
786
+ "The customer gets the same product free (Buy 2 get 1 free) or a limited "
787
+ "percentage (Buy 2 and get 1 at 50% discount)"
788
+ msgstr ""
789
+
790
+ #: includes/discount-base.php:1136
791
+ msgid ""
792
+ "Provide a specific product free when purchasing another product."
793
+ "<br><br>Example: Buy Product A and get Product B free. Product B will be "
794
+ "automatically added to cart."
795
+ msgstr ""
796
+
797
+ #: includes/discount-base.php:1137
798
+ msgid ""
799
+ "Provide a specific product free when purchasing another product."
800
+ "<br><br>Instead of automatically adding, if you wish to choose the free "
801
+ "product, you can select this option.<br><br>Note : Product will be "
802
+ "discounted only when the user manually adds the product to cart."
803
+ msgstr ""
804
+
805
+ #: includes/discount-base.php:1138
806
+ msgid ""
807
+ "Used to provide BOGO discount within categories.<br><br>Example 1: Buy 2 "
808
+ "from Category A and get 1 free from the same Category A.<br>Example 2: Buy "
809
+ "any items from Category A and get 20% (limited percent) discount on Category "
810
+ "B."
811
+ msgstr ""
812
+
813
+ #: includes/discount-base.php:1139
814
+ msgid ""
815
+ "This allows you to offer the cheapest product in cart for free (or at a "
816
+ "limited percentage like 50%)"
817
+ msgstr ""
818
+
819
+ #: includes/discount-base.php:1221
820
+ #, php-format
821
+ msgid ""
822
+ "Sorry, it is not possible to apply coupon <b>\"%s\"</b> as you already have "
823
+ "a discount applied in cart."
824
+ msgstr ""
825
+
826
+ #: includes/discount-base.php:1276 view/includes/menu.php:13
827
  msgid "Settings"
828
  msgstr ""
829
 
830
+ #: includes/pricing-rules.php:3172 view/view-pricing-rules.php:601
831
  msgid "Buy"
832
  msgstr ""
833
 
834
+ #: includes/pricing-rules.php:3176
835
  msgid " less than or equal to "
836
  msgstr ""
837
 
838
+ #: includes/pricing-rules.php:3176 includes/pricing-rules.php:3182
839
  msgid " Quantity"
840
  msgstr ""
841
 
842
+ #: includes/pricing-rules.php:3179
843
  msgid " Quantity "
844
  msgstr ""
845
 
846
+ #: includes/pricing-rules.php:3186
847
  msgid " or more Quantity"
848
  msgstr ""
849
 
850
+ #: includes/pricing-rules.php:3195
851
  msgid " any "
852
  msgstr ""
853
 
854
+ #: includes/pricing-rules.php:3195
855
  msgid " products from "
856
  msgstr ""
857
 
858
+ #: includes/pricing-rules.php:3202
859
  msgid " in each products"
860
  msgstr ""
861
 
862
+ #: includes/pricing-rules.php:3214
863
  msgid " and get discount on "
864
  msgstr ""
865
 
866
+ #: includes/pricing-rules.php:3217
867
  msgid " first "
868
  msgstr ""
869
 
870
+ #: includes/pricing-rules.php:3219 includes/pricing-rules.php:3223
871
  msgid " quantity of product(s) - "
872
  msgstr ""
873
 
874
+ #: includes/pricing-rules.php:3221
875
  msgid " after first "
876
  msgstr ""
877
 
878
+ #: includes/pricing-rules.php:3239
879
  msgid "Category(ies) "
880
  msgstr ""
881
 
882
+ #: includes/pricing-rules.php:3310
883
  msgid "Get "
884
  msgstr ""
885
 
886
+ #: includes/pricing-rules.php:3312
887
  #, php-format
888
  msgid "% discount in "
889
  msgstr ""
890
 
891
+ #: includes/pricing-rules.php:3315
892
  msgid "same product"
893
  msgstr ""
894
 
895
+ #: includes/pricing-rules.php:3317
896
  msgid "any cheapest one from cart"
897
  msgstr ""
898
 
899
+ #: includes/pricing-rules.php:3320
900
  msgid "any cheapest one of "
901
  msgstr ""
902
 
903
+ #: includes/pricing-rules.php:3325
904
  msgid " quantity of any "
905
  msgstr ""
906
 
907
+ #: includes/pricing-rules.php:3327
908
  msgid " cheapest item "
909
  msgstr ""
910
 
911
+ #: includes/pricing-rules.php:3330
912
  msgid " quantity of cheapest item "
913
  msgstr ""
914
 
915
+ #: includes/pricing-rules.php:3334
916
  msgid "from the category "
917
  msgstr ""
918
 
919
+ #: includes/pricing-rules.php:3356
920
  #, php-format
921
  msgid "%s for %s Quantity(s)"
922
  msgstr ""
923
 
924
+ #: includes/pricing-rules.php:3358
925
  #, php-format
926
  msgid "%s as price per unit"
927
  msgstr ""
1043
  msgid "Apply"
1044
  msgstr ""
1045
 
1046
+ #: view/cart-rules.php:98 view/cart-rules.php:208 view/pricing-rules.php:128
1047
+ #: view/pricing-rules.php:238 view/template/discount-table.php:36
1048
  msgid "Name"
1049
  msgstr ""
1050
 
1051
+ #: view/cart-rules.php:99 view/cart-rules.php:209 view/pricing-rules.php:129
1052
+ #: view/pricing-rules.php:239
1053
  msgid "Start Date"
1054
  msgstr ""
1055
 
1056
+ #: view/cart-rules.php:100 view/cart-rules.php:210 view/pricing-rules.php:130
1057
+ #: view/pricing-rules.php:240
1058
  msgid "Expired On"
1059
  msgstr ""
1060
 
1061
+ #: view/cart-rules.php:101 view/cart-rules.php:211 view/pricing-rules.php:131
1062
+ #: view/pricing-rules.php:241
1063
  msgid "Status"
1064
  msgstr ""
1065
 
1066
+ #: view/cart-rules.php:104 view/cart-rules.php:214 view/pricing-rules.php:134
1067
+ #: view/pricing-rules.php:244
1068
  msgid "Language"
1069
  msgstr ""
1070
 
1071
+ #: view/cart-rules.php:109 view/cart-rules.php:219 view/pricing-rules.php:139
1072
+ #: view/pricing-rules.php:249
1073
  msgid "Order"
1074
  msgstr ""
1075
 
1076
+ #: view/cart-rules.php:181 view/pricing-rules.php:211
1077
  msgid "Edit"
1078
  msgstr ""
1079
 
1080
+ #: view/cart-rules.php:192 view/pricing-rules.php:222
1081
  msgid "Delete"
1082
  msgstr ""
1083
 
1899
  msgstr ""
1900
 
1901
  #: view/view-cart-rules.php:749 view/view-cart-rules.php:846
1902
+ #: view/view-pricing-rules.php:659 view/view-pricing-rules.php:964
1903
  msgid "Previous"
1904
  msgstr ""
1905
 
2186
  "(Set) Discount, other ranges should also be same type."
2187
  msgstr ""
2188
 
2189
+ #: view/view-pricing-rules.php:930
2190
  msgid ""
2191
  "<b>Example for Bundle (Set) Discount:</b> 3 for $10, 6 for $20<br>So "
2192
  "customer can add 3 products / quantities and get them for $10<br><b>NOTE:</"
2194
  "the 3 for $10 deal)"
2195
  msgstr ""
2196
 
2197
+ #: view/view-pricing-rules.php:932 view/view-pricing-rules.php:942
2198
  msgid "Read docs"
2199
  msgstr ""
2200
 
2201
+ #: view/view-pricing-rules.php:940
2202
  msgid ""
2203
  "<b>Example for Fixed Price Per Unit:</b> Product A cost is $20. If customers "
2204
  "buy 5 to 10, they can get at $15 each (per unit).<br>Customer adds 6 "
2206
  "b> Enter the Unit price like 15"
2207
  msgstr ""
2208
 
2209
+ #: view/view-pricing-rules.php:947
2210
  msgid "Guide to create perfect BOGO rules"
2211
  msgstr ""
2212
 
2213
+ #: view/view-pricing-rules.php:957
2214
  msgid "Percent"
2215
  msgstr ""
2216
 
2217
+ #: view/view-pricing-rules.php:958
2218
  msgid "Fixed"
2219
  msgstr ""
includes/cart-rules.php CHANGED
@@ -82,6 +82,8 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
82
  protected $checked_for_categories_and_product_match = false;
83
  protected $categories_and_product_match_value = false;
84
 
 
 
85
  /**
86
  * FlycartWooDiscountRulesCartRules constructor.
87
  */
@@ -150,6 +152,24 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
150
  'promotion_message',
151
  );
152
  $coupons_used = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  $request['dynamic_coupons_to_apply'] = '';
154
  $coupon_keys = array('coupon_applied_any_one','coupon_applied_all_selected', 'create_dynamic_coupon');
155
  foreach ($request['discount_rule'] as $index => $value) {
@@ -325,10 +345,12 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
325
  do_action('woo_discount_rules_after_fetching_discount', $this);
326
  global $flycart_woo_discount_rules;
327
  $flycart_woo_discount_rules->cart_rules = $this;
 
 
 
328
  // Add a Coupon Virtually (Temporary access).
329
  if(!$free_shipping_check)
330
  if ($this->discount_total != 0) {
331
- if(!FlycartWooDiscountRulesGeneralHelper::haveToApplyTheRules()) return false;
332
  add_filter('woocommerce_get_shop_coupon_data', array($this, 'addVirtualCoupon'), 10, 2);
333
  add_action('woocommerce_after_calculate_totals', array($this, 'applyFakeCoupons'), 10);
334
  }
@@ -436,7 +458,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
436
  if (in_array($old_coupon_code, $coupon_codes) || in_array(wc_strtolower($old_coupon_code), $coupon_codes)) {
437
  if (in_array($this->postData->get('remove_coupon', false), $coupon_codes)) return false;
438
  $this->makeLog();
439
- $discount_type = 'fixed_cart';
440
  $amount = $bogo_coupon_codes[wc_strtolower($old_coupon_code)]['amount'];
441
 
442
  $coupon = array(
@@ -1105,9 +1127,13 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1105
  return true;
1106
  break;
1107
  case 'shipping_countries_in':
1108
- // $user_meta = get_user_meta(get_current_user_id());
1109
- $shippingCountry = WC()->customer->get_shipping_country();
1110
- // if (!$user_meta || !isset($user_meta['shipping_country']) || empty($user_meta['shipping_country']) || !in_array($user_meta['shipping_country'][0], $rule)) {
 
 
 
 
1111
  if (empty($shippingCountry) || !in_array($shippingCountry, $rule)) {
1112
  return false;
1113
  }
@@ -1254,6 +1280,19 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1254
  $postDataArray['shipping_state'] = FlycartWoocommerceOrder::get_shipping_state($order);
1255
  }
1256
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1257
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
1258
  $shippingState = $postDataArray[$shippingFieldName];
1259
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
@@ -1303,6 +1342,19 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1303
  $postDataArray['shipping_city'] = FlycartWoocommerceOrder::get_shipping_city($order);
1304
  }
1305
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1306
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
1307
  $shippingState = $postDataArray[$shippingFieldName];
1308
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
@@ -1339,6 +1391,10 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1339
  if($postShippingState != ''){
1340
  $postDataArray[$shippingFieldName] = $postShippingState;
1341
  }
 
 
 
 
1342
  if(!get_current_user_id()){
1343
  $order_id = $this->postData->get('order-received', 0);
1344
  if($order_id){
@@ -1346,6 +1402,19 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1346
  $postDataArray['shipping_postcode'] = FlycartWoocommerceOrder::get_shipping_city($order);
1347
  }
1348
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1349
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
1350
  $shippingState = $postDataArray[$shippingFieldName];
1351
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
@@ -1368,20 +1437,22 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1368
  case 'exclude_categories':
1369
  case 'atleast_one_including_sub_categories':
1370
  case 'in_each_category':
1371
- if(count($rule)){
1372
- $ruleSuccess = $this->validateCartItemsInSelectedProductsAndCategories($index, $rule, $rules, $rules_with_all_data, $rule_sets);
1373
- if($ruleSuccess){
1374
- return true;
1375
- }
1376
  }
1377
- return false;
1378
  break;
1379
  case 'customer_based_on_first_order':
1380
  case 'customer_based_on_purchase_history':
1381
  case 'customer_based_on_purchase_history_order_count':
1382
  case 'customer_based_on_purchase_history_product_order_count':
1383
  case 'customer_based_on_purchase_history_product_quantity_count':
1384
- if(count($rule)){
 
 
 
1385
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
1386
  if($ruleSuccess){
1387
  return true;
@@ -1392,12 +1463,6 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1392
  case 'create_dynamic_coupon':
1393
  case 'coupon_applied_any_one':
1394
  if(!empty($rule)){
1395
- if($index == 'create_dynamic_coupon'){
1396
- $apply_discount_in_same_coupon = apply_filters('woo_discount_rules_apply_discount_in_same_coupon_code_which_created', true, $rule, $rules);
1397
- if($apply_discount_in_same_coupon){
1398
- $this->coupon_code = $rule;
1399
- }
1400
- }
1401
  $ruleSuccess = $this->validateCartCouponAppliedAnyOne($index, $rule, $rules);
1402
  if($ruleSuccess){
1403
  if(is_string($rule)){
@@ -1410,6 +1475,12 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1410
  if($index == 'coupon_applied_any_one') {
1411
  FlycartWooDiscountRulesGeneralHelper::removeCouponPriceInCart($coupons);
1412
  }
 
 
 
 
 
 
1413
  return true;
1414
  }
1415
  }
@@ -1669,28 +1740,66 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1669
  *
1670
  * @param $product object
1671
  * @param $categories array
 
 
1672
  * @return boolean
1673
  * */
1674
- protected function checkAllCategoryFoundInCart($product, $categories){
1675
  global $woocommerce;
1676
- $all_product_categories = array();
1677
  $result = false;
 
1678
  foreach ($woocommerce->cart->cart_contents as $key => $cartItem) {
1679
  $product_categories = FlycartWoocommerceProduct::get_category_ids($cartItem['data']);
1680
- if(!empty($product_categories)){
1681
- if(is_array($product_categories)){
1682
- $all_product_categories = array_merge($all_product_categories, $product_categories);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1683
  }
1684
  }
1685
  }
1686
- if(!empty($all_product_categories)){
1687
- $all_product_categories = array_unique($all_product_categories);
1688
- $intersect_categories = array_intersect($categories, $all_product_categories);
1689
- }
1690
-
1691
- if(!empty($intersect_categories)) {
1692
- if (count($intersect_categories) == count($categories)) {
1693
- $result = true;
 
 
 
 
 
 
 
 
 
1694
  }
1695
  }
1696
 
@@ -1813,9 +1922,10 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1813
  * @param $product object
1814
  * @param $rules array
1815
  * @param $rules_with_all_data array
 
1816
  * @return boolean
1817
  * */
1818
- protected function checkForCategoryAndProductMatchesForAnProduct($product, $rules, $rules_with_all_data){
1819
  $allow_discount = true;
1820
  if(isset($rules['categories_in'])){
1821
  if(!empty($rules['categories_in']) && is_array($rules['categories_in'])){
@@ -1852,7 +1962,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1852
  if($allow_discount){
1853
  if(isset($rules['in_each_category'])){
1854
  if(!empty($rules['in_each_category']) && is_array($rules['in_each_category'])){
1855
- $has_found_each_category = $this->checkAllCategoryFoundInCart($product, $rules['in_each_category']);
1856
  if($has_found_each_category){
1857
  $found_at_least_one = false;
1858
  foreach ($rules['in_each_category'] as $category){
@@ -1895,7 +2005,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1895
  $allow_discount = $sub_total = $quantity = $item_count = 0;
1896
  if(count($woocommerce->cart->cart_contents)){
1897
  foreach ($woocommerce->cart->cart_contents as $key => $cartItem) {
1898
- $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cartItem['data'], $rules, $rules_with_all_data);
1899
  if($matches){
1900
  $allow_discount = 1;
1901
  $cart_item_quantity = (isset($cartItem['quantity']) && $cartItem['quantity']) ? $cartItem['quantity'] : 1;
@@ -1907,36 +2017,17 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1907
  }
1908
  if($allow_discount){
1909
  $ruleSuccess = 1;
1910
- if(is_array($rules) && count($rules)){
1911
- foreach ($rules as $rule_type => $rule_values){
1912
- $checkRuleTypes = array('quantity_least', 'quantity_less', 'subtotal_least', 'subtotal_less', 'item_count_least', 'item_count_less');
1913
- if(in_array($rule_type, $checkRuleTypes)){
1914
- if($rule_type == 'subtotal_least'){
1915
- if ($sub_total < $rule_values) {
1916
- $this->processPromotionMessage($rule_sets, $rule_values, $rule_type, array('subtotal' => $sub_total));
1917
- $ruleSuccess = 0;
1918
- }
1919
- } elseif ($rule_type == 'subtotal_less'){
1920
-
1921
- if ($sub_total >= $rule_values) {
1922
- $ruleSuccess = 0;
1923
- }
1924
- } elseif ($rule_type == 'item_count_least'){
1925
- if ($item_count < $rule_values) {
1926
- $ruleSuccess = 0;
1927
- }
1928
- } elseif ($rule_type == 'item_count_less'){
1929
- if ($item_count >= $rule_values) {
1930
- $ruleSuccess = 0;
1931
- }
1932
- } elseif ($rule_type == 'quantity_least'){
1933
- if ($quantity < $rule_values) {
1934
- $ruleSuccess = 0;
1935
- }
1936
- } elseif ($rule_type == 'quantity_less'){
1937
- if ($quantity >= $rule_values) {
1938
- $ruleSuccess = 0;
1939
- }
1940
  }
1941
  }
1942
  }
@@ -1946,6 +2037,53 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1946
  return $ruleSuccess;
1947
  }
1948
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1949
  /**
1950
  * Get tld from email
1951
  * */
@@ -2047,7 +2185,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2047
  $apply_discount = false;
2048
 
2049
  if($this->has_category_in_rule || $this->has_product_specific_rule){
2050
- $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cart_item['data'], $rules, $rules_with_all_data);
2051
  if($matches){
2052
  $apply_discount = true;
2053
  }
@@ -2136,7 +2274,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2136
  if (empty($product_ids))
2137
  return true;
2138
  if(empty($rule_text))
2139
- $rule_text = '{{product_name}} X {{quantity}}';
2140
  $carts = FlycartWoocommerceCart::get_cart();
2141
  if(empty($carts))
2142
  return true;
@@ -2146,7 +2284,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2146
  continue;
2147
  }
2148
  $product_id = FlycartWoocommerceProduct::get_id($cart_item['data']);
2149
- $added_products[$product_id] = array('item_name'=> FlycartWoocommerceProduct::get_name($cart_item['data']), 'item_quantity' => $cart_item['quantity'], 'item' => $cart_item_key, 'item_price' => FlycartWoocommerceProduct::get_price($cart_item['data'], true));
2150
  }
2151
  if(is_array($product_ids) && count($product_ids)){
2152
  foreach ($product_ids as $discounted_product_id) {
@@ -2160,26 +2298,29 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2160
  }
2161
  }
2162
  $discounted_price = ($discount_quantity * $added_products[$discounted_product_id]['item_price']);
2163
- $coupon_msg = str_replace(array('{{product_name}}','{{quantity}}'),array($added_products[$discounted_product_id]['item_name'],$discount_quantity),$rule_text);
2164
- $this->bogo_coupon_codes[wc_strtolower($coupon_msg)] = array('product_id'=>$discounted_product_id,'amount'=>$discounted_price);
2165
  } else {
2166
  //If product not in cart,then add to cart
2167
  $product = FlycartWoocommerceProduct::wc_get_product($discounted_product_id);
2168
  if($product) {
2169
- $cart_item_key = FlycartWoocommerceCart::add_to_cart($discounted_product_id, $discount_quantity);
2170
- global $flycart_woo_discount_rules;
2171
- add_filter('woo_discount_rules_apply_rules_repeatedly', '__return_true');//Fix: In few cases the strikeout doesn't applies
2172
- $flycart_woo_discount_rules->discountBase->handlePriceDiscount();
2173
- if(!empty($cart_item_key)){
2174
- $cart_item = FlycartWoocommerceCart::get_cart_item($cart_item_key);
2175
- if(!empty($cart_item['data'])){
2176
- $product = $cart_item['data'];
 
 
 
2177
  }
 
 
 
 
2178
  }
2179
- do_action('woo_discount_rules_cart_rules_after_adding_free_product_to_cart');
2180
- $discounted_price = ($discount_quantity * FlycartWoocommerceProduct::get_price($product, true));
2181
- $coupon_msg = str_replace(array('{{product_name}}', '{{quantity}}'), array(FlycartWoocommerceProduct::get_name($product, true), $discount_quantity), $rule_text);
2182
- $this->bogo_coupon_codes[wc_strtolower($coupon_msg)] = array('product_id'=>$discounted_product_id,'amount'=>$discounted_price);
2183
  }
2184
  }
2185
  $this->product_discount_total += $discounted_price;
@@ -2314,9 +2455,13 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2314
  return true;
2315
  break;
2316
  case 'shipping_countries_in':
2317
- // $user_meta = get_user_meta(get_current_user_id());
2318
- $shippingCountry = WC()->customer->get_shipping_country();
2319
- // if (!$user_meta || !isset($user_meta['shipping_country']) || empty($user_meta['shipping_country']) || !in_array($user_meta['shipping_country'][0], $rule)) {
 
 
 
 
2320
  if (empty($shippingCountry) || !in_array($shippingCountry, $rule)) {
2321
  return false;
2322
  }
@@ -2463,6 +2608,19 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2463
  $postDataArray['shipping_state'] = FlycartWoocommerceOrder::get_shipping_state($order);
2464
  }
2465
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2466
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
2467
  $shippingState = $postDataArray[$shippingFieldName];
2468
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
@@ -2512,6 +2670,19 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2512
  $postDataArray['shipping_city'] = FlycartWoocommerceOrder::get_shipping_city($order);
2513
  }
2514
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2515
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
2516
  $shippingState = $postDataArray[$shippingFieldName];
2517
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
@@ -2548,6 +2719,10 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2548
  if($postShippingState != ''){
2549
  $postDataArray[$shippingFieldName] = $postShippingState;
2550
  }
 
 
 
 
2551
  if(!get_current_user_id()){
2552
  $order_id = $this->postData->get('order-received', 0);
2553
  if($order_id){
@@ -2555,6 +2730,19 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2555
  $postDataArray['shipping_postcode'] = FlycartWoocommerceOrder::get_shipping_city($order);
2556
  }
2557
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2558
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
2559
  $shippingState = $postDataArray[$shippingFieldName];
2560
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
@@ -2577,20 +2765,22 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2577
  case 'exclude_categories':
2578
  case 'atleast_one_including_sub_categories':
2579
  case 'in_each_category':
2580
- if(count($rule)){
2581
- $ruleSuccess = $this->validateCartItemsInSelectedProductsAndCategories($index, $rule, $rules, $rules_with_all_data, $rule_sets);
2582
- if($ruleSuccess){
2583
- return true;
2584
- }
2585
  }
2586
- return false;
2587
  break;
2588
  case 'customer_based_on_first_order':
2589
  case 'customer_based_on_purchase_history':
2590
  case 'customer_based_on_purchase_history_order_count':
2591
  case 'customer_based_on_purchase_history_product_order_count':
2592
  case 'customer_based_on_purchase_history_product_quantity_count':
2593
- if(count($rule)){
 
 
 
2594
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
2595
  if($ruleSuccess){
2596
  return true;
@@ -2652,5 +2842,35 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2652
  public static function getAppliedCoupons(){
2653
  return self::$applied_coupon;
2654
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2655
  }
2656
  }
82
  protected $checked_for_categories_and_product_match = false;
83
  protected $categories_and_product_match_value = false;
84
 
85
+ protected static $added_bogo_product_ids = array();
86
+
87
  /**
88
  * FlycartWooDiscountRulesCartRules constructor.
89
  */
152
  'promotion_message',
153
  );
154
  $coupons_used = array();
155
+ if($request['discount_type'] == 'product_discount'){
156
+ if(!empty($request['cart_discounted_products']) && !empty($request['product_discount_quantity'])){
157
+ $coupon_code_text = apply_filters('woo_discount_rules_cart_bogo_coupon_code', '{{product_name}} X {{quantity}}');
158
+ $cart_discounted_products = $request['cart_discounted_products'];
159
+ if(is_string($request['cart_discounted_products'])){
160
+ $cart_discounted_products = json_decode($request['cart_discounted_products']);
161
+ }
162
+ if(!empty($cart_discounted_products) && is_array($cart_discounted_products)){
163
+ foreach ($cart_discounted_products as $product_id){
164
+ $product = FlycartWoocommerceProduct::wc_get_product($product_id);
165
+ if($product){
166
+ $product_name = FlycartWoocommerceProduct::get_name($product);
167
+ $coupons_used[] = self::formatBOGOCouponCode($product_name, $request['product_discount_quantity'], $product, $coupon_code_text);
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
  $request['dynamic_coupons_to_apply'] = '';
174
  $coupon_keys = array('coupon_applied_any_one','coupon_applied_all_selected', 'create_dynamic_coupon');
175
  foreach ($request['discount_rule'] as $index => $value) {
345
  do_action('woo_discount_rules_after_fetching_discount', $this);
346
  global $flycart_woo_discount_rules;
347
  $flycart_woo_discount_rules->cart_rules = $this;
348
+
349
+ if(!FlycartWooDiscountRulesGeneralHelper::haveToApplyTheRules()) return false;
350
+
351
  // Add a Coupon Virtually (Temporary access).
352
  if(!$free_shipping_check)
353
  if ($this->discount_total != 0) {
 
354
  add_filter('woocommerce_get_shop_coupon_data', array($this, 'addVirtualCoupon'), 10, 2);
355
  add_action('woocommerce_after_calculate_totals', array($this, 'applyFakeCoupons'), 10);
356
  }
458
  if (in_array($old_coupon_code, $coupon_codes) || in_array(wc_strtolower($old_coupon_code), $coupon_codes)) {
459
  if (in_array($this->postData->get('remove_coupon', false), $coupon_codes)) return false;
460
  $this->makeLog();
461
+ $discount_type = 'fixed_product';
462
  $amount = $bogo_coupon_codes[wc_strtolower($old_coupon_code)]['amount'];
463
 
464
  $coupon = array(
1127
  return true;
1128
  break;
1129
  case 'shipping_countries_in':
1130
+ $postCalcShippingCountry = $this->postData->get('calc_shipping_country', '');
1131
+ if(!empty($postCalcShippingCountry)){
1132
+ $shippingCountry = $postCalcShippingCountry;
1133
+ }
1134
+ if(empty($shippingCountry)){
1135
+ $shippingCountry = WC()->customer->get_shipping_country();
1136
+ }
1137
  if (empty($shippingCountry) || !in_array($shippingCountry, $rule)) {
1138
  return false;
1139
  }
1280
  $postDataArray['shipping_state'] = FlycartWoocommerceOrder::get_shipping_state($order);
1281
  }
1282
  }
1283
+
1284
+ $customer_from_session = FlycartWoocommerceSession::getSession('customer');
1285
+ if(!empty($customer_from_session)){
1286
+ if(isset($customer_from_session[$shippingFieldName])){
1287
+ $postDataArray[$shippingFieldName] = $customer_from_session[$shippingFieldName];
1288
+ } else if(isset($customer_from_session['shipping_state'])){
1289
+ $postDataArray['shipping_state'] = $customer_from_session['shipping_state'];
1290
+ if(empty($postDataArray[$shippingFieldName])){
1291
+ $postDataArray[$shippingFieldName] = $postDataArray['shipping_state'];
1292
+ }
1293
+ }
1294
+ }
1295
+
1296
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
1297
  $shippingState = $postDataArray[$shippingFieldName];
1298
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
1342
  $postDataArray['shipping_city'] = FlycartWoocommerceOrder::get_shipping_city($order);
1343
  }
1344
  }
1345
+
1346
+ $customer_from_session = FlycartWoocommerceSession::getSession('customer');
1347
+ if(!empty($customer_from_session)){
1348
+ if(isset($customer_from_session[$shippingFieldName])){
1349
+ $postDataArray[$shippingFieldName] = $customer_from_session[$shippingFieldName];
1350
+ } else if(isset($customer_from_session['shipping_city'])){
1351
+ $postDataArray['shipping_city'] = $customer_from_session['shipping_city'];
1352
+ if(empty($postDataArray[$shippingFieldName])){
1353
+ $postDataArray[$shippingFieldName] = $postDataArray['shipping_city'];
1354
+ }
1355
+ }
1356
+ }
1357
+
1358
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
1359
  $shippingState = $postDataArray[$shippingFieldName];
1360
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
1391
  if($postShippingState != ''){
1392
  $postDataArray[$shippingFieldName] = $postShippingState;
1393
  }
1394
+ $post_calc_shipping_postcode = $this->postData->get('calc_shipping_postcode', '', 'raw');
1395
+ if(!empty($post_calc_shipping_postcode)){
1396
+ $postDataArray[$shippingFieldName] = $post_calc_shipping_postcode;
1397
+ }
1398
  if(!get_current_user_id()){
1399
  $order_id = $this->postData->get('order-received', 0);
1400
  if($order_id){
1402
  $postDataArray['shipping_postcode'] = FlycartWoocommerceOrder::get_shipping_city($order);
1403
  }
1404
  }
1405
+
1406
+ $customer_from_session = FlycartWoocommerceSession::getSession('customer');
1407
+ if(!empty($customer_from_session)){
1408
+ if(isset($customer_from_session[$shippingFieldName])){
1409
+ $postDataArray[$shippingFieldName] = $customer_from_session[$shippingFieldName];
1410
+ } else if(isset($customer_from_session['shipping_postcode'])){
1411
+ $postDataArray['shipping_postcode'] = $customer_from_session['shipping_postcode'];
1412
+ if(empty($postDataArray[$shippingFieldName])){
1413
+ $postDataArray[$shippingFieldName] = $postDataArray['shipping_postcode'];
1414
+ }
1415
+ }
1416
+ }
1417
+
1418
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
1419
  $shippingState = $postDataArray[$shippingFieldName];
1420
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
1437
  case 'exclude_categories':
1438
  case 'atleast_one_including_sub_categories':
1439
  case 'in_each_category':
1440
+ $ruleSuccess = $this->validateCartItemsInSelectedProductsAndCategories($index, $rule, $rules, $rules_with_all_data, $rule_sets);
1441
+ if($ruleSuccess){
1442
+ return true;
1443
+ } else {
1444
+ return false;
1445
  }
 
1446
  break;
1447
  case 'customer_based_on_first_order':
1448
  case 'customer_based_on_purchase_history':
1449
  case 'customer_based_on_purchase_history_order_count':
1450
  case 'customer_based_on_purchase_history_product_order_count':
1451
  case 'customer_based_on_purchase_history_product_quantity_count':
1452
+ if($index == 'customer_based_on_first_order'){
1453
+ $rule = array();
1454
+ }
1455
+ if($index == 'customer_based_on_first_order' || count($rule)){
1456
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
1457
  if($ruleSuccess){
1458
  return true;
1463
  case 'create_dynamic_coupon':
1464
  case 'coupon_applied_any_one':
1465
  if(!empty($rule)){
 
 
 
 
 
 
1466
  $ruleSuccess = $this->validateCartCouponAppliedAnyOne($index, $rule, $rules);
1467
  if($ruleSuccess){
1468
  if(is_string($rule)){
1475
  if($index == 'coupon_applied_any_one') {
1476
  FlycartWooDiscountRulesGeneralHelper::removeCouponPriceInCart($coupons);
1477
  }
1478
+ if($index == 'create_dynamic_coupon'){
1479
+ $apply_discount_in_same_coupon = apply_filters('woo_discount_rules_apply_discount_in_same_coupon_code_which_created', true, $rule, $rules);
1480
+ if($apply_discount_in_same_coupon){
1481
+ $this->coupon_code = $rule;
1482
+ }
1483
+ }
1484
  return true;
1485
  }
1486
  }
1740
  *
1741
  * @param $product object
1742
  * @param $categories array
1743
+ * @param $rules array
1744
+ * @param $rule_sets array
1745
  * @return boolean
1746
  * */
1747
+ protected function checkAllCategoryFoundInCart($product, $categories, $rules, $rule_sets, $rules_with_all_data){
1748
  global $woocommerce;
 
1749
  $result = false;
1750
+ $sub_total = $item_count = $quantity = array();
1751
  foreach ($woocommerce->cart->cart_contents as $key => $cartItem) {
1752
  $product_categories = FlycartWoocommerceProduct::get_category_ids($cartItem['data']);
1753
+ $allow_discount = $this->checkForProductConditionsMatchesForAnProduct($product, $rules, $rules_with_all_data);
1754
+ if($allow_discount){
1755
+ if(!empty($product_categories)){
1756
+ if(is_array($product_categories)){
1757
+ foreach ($categories as $c_key => $cat_id){
1758
+ if(in_array($cat_id, $product_categories)){
1759
+ $_quantity = (isset($cartItem['quantity']) && $cartItem['quantity']) ? $cartItem['quantity'] : 1;
1760
+ $_sub_total = self::getSubTotalOfCartItem($cartItem);
1761
+ $_item_count = 1;
1762
+
1763
+ if(isset($sub_total[$cat_id])){
1764
+ $sub_total[$cat_id] += $_sub_total;
1765
+ } else {
1766
+ $sub_total[$cat_id] = $_sub_total;
1767
+ }
1768
+
1769
+ if(isset($item_count[$cat_id])){
1770
+ $item_count[$cat_id] += $_item_count;
1771
+ } else {
1772
+ $item_count[$cat_id] = $_item_count;
1773
+ }
1774
+
1775
+ if(isset($quantity[$cat_id])){
1776
+ $quantity[$cat_id] += $_quantity;
1777
+ } else {
1778
+ $quantity[$cat_id] = $_quantity;
1779
+ }
1780
+ }
1781
+ }
1782
+ }
1783
  }
1784
  }
1785
  }
1786
+ foreach ($categories as $c_key => $cat_id){
1787
+ $specific_cat = true;
1788
+ foreach ($rules as $rule_type => $rule_values) {
1789
+ if(!isset($sub_total[$cat_id])) $sub_total[$cat_id] = 0;
1790
+ if(!isset($item_count[$cat_id])) $item_count[$cat_id] = 0;
1791
+ if(!isset($quantity[$cat_id])) $quantity[$cat_id] = 0;
1792
+ $ruleSuccess = $this->checkQtySubTotalConditionsMatches($rule_type, $rule_values, $rule_sets, $sub_total[$cat_id], $item_count[$cat_id], $quantity[$cat_id]);
1793
+ if (!$ruleSuccess) {
1794
+ $specific_cat = $result = false;
1795
+ break;
1796
+ } else {
1797
+ $result = true;
1798
+ }
1799
+ }
1800
+ if($specific_cat === false){
1801
+ $result = false;
1802
+ break;
1803
  }
1804
  }
1805
 
1922
  * @param $product object
1923
  * @param $rules array
1924
  * @param $rules_with_all_data array
1925
+ * @param $rule_sets array
1926
  * @return boolean
1927
  * */
1928
+ protected function checkForCategoryAndProductMatchesForAnProduct($product, $rules, $rules_with_all_data, $rule_sets){
1929
  $allow_discount = true;
1930
  if(isset($rules['categories_in'])){
1931
  if(!empty($rules['categories_in']) && is_array($rules['categories_in'])){
1962
  if($allow_discount){
1963
  if(isset($rules['in_each_category'])){
1964
  if(!empty($rules['in_each_category']) && is_array($rules['in_each_category'])){
1965
+ $has_found_each_category = $this->checkAllCategoryFoundInCart($product, $rules['in_each_category'], $rules, $rule_sets, $rules_with_all_data);
1966
  if($has_found_each_category){
1967
  $found_at_least_one = false;
1968
  foreach ($rules['in_each_category'] as $category){
2005
  $allow_discount = $sub_total = $quantity = $item_count = 0;
2006
  if(count($woocommerce->cart->cart_contents)){
2007
  foreach ($woocommerce->cart->cart_contents as $key => $cartItem) {
2008
+ $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cartItem['data'], $rules, $rules_with_all_data, $rule_sets);
2009
  if($matches){
2010
  $allow_discount = 1;
2011
  $cart_item_quantity = (isset($cartItem['quantity']) && $cartItem['quantity']) ? $cartItem['quantity'] : 1;
2017
  }
2018
  if($allow_discount){
2019
  $ruleSuccess = 1;
2020
+ $process_condition_check = true;
2021
+ if(isset($rules['in_each_category']) && !empty($rules['in_each_category'])){
2022
+ $process_condition_check = false;
2023
+ }
2024
+ if($process_condition_check){
2025
+ if(is_array($rules) && count($rules)){
2026
+ foreach ($rules as $rule_type => $rule_values){
2027
+ $ruleSuccessResult = $this->checkQtySubTotalConditionsMatches($rule_type, $rule_values, $rule_sets, $sub_total, $item_count, $quantity);
2028
+ if(!$ruleSuccessResult){
2029
+ $ruleSuccess = 0;
2030
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2031
  }
2032
  }
2033
  }
2037
  return $ruleSuccess;
2038
  }
2039
 
2040
+ /**
2041
+ * Check Quantity, Sub-Total, Item Count matches
2042
+ *
2043
+ * @param $rule_type string
2044
+ * @param $rule_values mixed
2045
+ * @param $rule_sets array
2046
+ * @param $sub_total float
2047
+ * @param $item_count int
2048
+ * @param $quantity int
2049
+ *
2050
+ * @return int
2051
+ * */
2052
+ protected function checkQtySubTotalConditionsMatches($rule_type, $rule_values, $rule_sets, $sub_total, $item_count, $quantity){
2053
+ $ruleSuccess = 1;
2054
+ $checkRuleTypes = array('quantity_least', 'quantity_less', 'subtotal_least', 'subtotal_less', 'item_count_least', 'item_count_less');
2055
+ if(in_array($rule_type, $checkRuleTypes)){
2056
+ if($rule_type == 'subtotal_least'){
2057
+ if ($sub_total < $rule_values) {
2058
+ $this->processPromotionMessage($rule_sets, $rule_values, $rule_type, array('subtotal' => $sub_total));
2059
+ $ruleSuccess = 0;
2060
+ }
2061
+ } elseif ($rule_type == 'subtotal_less'){
2062
+ if ($sub_total >= $rule_values) {
2063
+ $ruleSuccess = 0;
2064
+ }
2065
+ } elseif ($rule_type == 'item_count_least'){
2066
+ if ($item_count < $rule_values) {
2067
+ $ruleSuccess = 0;
2068
+ }
2069
+ } elseif ($rule_type == 'item_count_less'){
2070
+ if ($item_count >= $rule_values) {
2071
+ $ruleSuccess = 0;
2072
+ }
2073
+ } elseif ($rule_type == 'quantity_least'){
2074
+ if ($quantity < $rule_values) {
2075
+ $ruleSuccess = 0;
2076
+ }
2077
+ } elseif ($rule_type == 'quantity_less'){
2078
+ if ($quantity >= $rule_values) {
2079
+ $ruleSuccess = 0;
2080
+ }
2081
+ }
2082
+ }
2083
+
2084
+ return $ruleSuccess;
2085
+ }
2086
+
2087
  /**
2088
  * Get tld from email
2089
  * */
2185
  $apply_discount = false;
2186
 
2187
  if($this->has_category_in_rule || $this->has_product_specific_rule){
2188
+ $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cart_item['data'], $rules, $rules_with_all_data, $rule);
2189
  if($matches){
2190
  $apply_discount = true;
2191
  }
2274
  if (empty($product_ids))
2275
  return true;
2276
  if(empty($rule_text))
2277
+ $rule_text = apply_filters('woo_discount_rules_cart_bogo_coupon_code', '{{product_name}} X {{quantity}}');
2278
  $carts = FlycartWoocommerceCart::get_cart();
2279
  if(empty($carts))
2280
  return true;
2284
  continue;
2285
  }
2286
  $product_id = FlycartWoocommerceProduct::get_id($cart_item['data']);
2287
+ $added_products[$product_id] = array('product'=> $cart_item['data'], 'item_name'=> FlycartWoocommerceProduct::get_name($cart_item['data']), 'item_quantity' => $cart_item['quantity'], 'item' => $cart_item_key, 'item_price' => FlycartWoocommerceProduct::get_price($cart_item['data'], true));
2288
  }
2289
  if(is_array($product_ids) && count($product_ids)){
2290
  foreach ($product_ids as $discounted_product_id) {
2298
  }
2299
  }
2300
  $discounted_price = ($discount_quantity * $added_products[$discounted_product_id]['item_price']);
2301
+ $coupon_msg = self::formatBOGOCouponCode($added_products[$discounted_product_id]['item_name'], $discount_quantity, $added_products[$discounted_product_id]['product'], $rule_text);
2302
+ $this->bogo_coupon_codes[$coupon_msg] = array('product_id' => $discounted_product_id, 'amount' => $discounted_price);
2303
  } else {
2304
  //If product not in cart,then add to cart
2305
  $product = FlycartWoocommerceProduct::wc_get_product($discounted_product_id);
2306
  if($product) {
2307
+ if(!(!empty(self::$added_bogo_product_ids) && in_array($discounted_product_id, self::$added_bogo_product_ids))){
2308
+ $cart_item_key = FlycartWoocommerceCart::add_to_cart($discounted_product_id, $discount_quantity);
2309
+ self::$added_bogo_product_ids[] = $discounted_product_id;
2310
+ global $flycart_woo_discount_rules;
2311
+ add_filter('woo_discount_rules_apply_rules_repeatedly', '__return_true');//Fix: In few cases the strikeout doesn't applies
2312
+ $flycart_woo_discount_rules->discountBase->handlePriceDiscount();
2313
+ if(!empty($cart_item_key)){
2314
+ $cart_item = FlycartWoocommerceCart::get_cart_item($cart_item_key);
2315
+ if(!empty($cart_item['data'])){
2316
+ $product = $cart_item['data'];
2317
+ }
2318
  }
2319
+ do_action('woo_discount_rules_cart_rules_after_adding_free_product_to_cart');
2320
+ $discounted_price = ($discount_quantity * FlycartWoocommerceProduct::get_price($product, true));
2321
+ $coupon_msg = self::formatBOGOCouponCode(FlycartWoocommerceProduct::get_name($product), $discount_quantity, $product, $rule_text);
2322
+ $this->bogo_coupon_codes[$coupon_msg] = array('product_id' => $discounted_product_id, 'amount' => $discounted_price);
2323
  }
 
 
 
 
2324
  }
2325
  }
2326
  $this->product_discount_total += $discounted_price;
2455
  return true;
2456
  break;
2457
  case 'shipping_countries_in':
2458
+ $postCalcShippingCountry = $this->postData->get('calc_shipping_country', '');
2459
+ if(!empty($postCalcShippingCountry)){
2460
+ $shippingCountry = $postCalcShippingCountry;
2461
+ }
2462
+ if(empty($shippingCountry)){
2463
+ $shippingCountry = WC()->customer->get_shipping_country();
2464
+ }
2465
  if (empty($shippingCountry) || !in_array($shippingCountry, $rule)) {
2466
  return false;
2467
  }
2608
  $postDataArray['shipping_state'] = FlycartWoocommerceOrder::get_shipping_state($order);
2609
  }
2610
  }
2611
+
2612
+ $customer_from_session = FlycartWoocommerceSession::getSession('customer');
2613
+ if(!empty($customer_from_session)){
2614
+ if(isset($customer_from_session[$shippingFieldName])){
2615
+ $postDataArray[$shippingFieldName] = $customer_from_session[$shippingFieldName];
2616
+ } else if(isset($customer_from_session['shipping_state'])){
2617
+ $postDataArray['shipping_state'] = $customer_from_session['shipping_state'];
2618
+ if(empty($postDataArray[$shippingFieldName])){
2619
+ $postDataArray[$shippingFieldName] = $postDataArray['shipping_state'];
2620
+ }
2621
+ }
2622
+ }
2623
+
2624
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
2625
  $shippingState = $postDataArray[$shippingFieldName];
2626
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
2670
  $postDataArray['shipping_city'] = FlycartWoocommerceOrder::get_shipping_city($order);
2671
  }
2672
  }
2673
+
2674
+ $customer_from_session = FlycartWoocommerceSession::getSession('customer');
2675
+ if(!empty($customer_from_session)){
2676
+ if(isset($customer_from_session[$shippingFieldName])){
2677
+ $postDataArray[$shippingFieldName] = $customer_from_session[$shippingFieldName];
2678
+ } else if(isset($customer_from_session['shipping_city'])){
2679
+ $postDataArray['shipping_city'] = $customer_from_session['shipping_city'];
2680
+ if(empty($postDataArray[$shippingFieldName])){
2681
+ $postDataArray[$shippingFieldName] = $postDataArray['shipping_city'];
2682
+ }
2683
+ }
2684
+ }
2685
+
2686
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
2687
  $shippingState = $postDataArray[$shippingFieldName];
2688
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
2719
  if($postShippingState != ''){
2720
  $postDataArray[$shippingFieldName] = $postShippingState;
2721
  }
2722
+ $post_calc_shipping_postcode = $this->postData->get('calc_shipping_postcode', '', 'raw');
2723
+ if(!empty($post_calc_shipping_postcode)){
2724
+ $postDataArray[$shippingFieldName] = $post_calc_shipping_postcode;
2725
+ }
2726
  if(!get_current_user_id()){
2727
  $order_id = $this->postData->get('order-received', 0);
2728
  if($order_id){
2730
  $postDataArray['shipping_postcode'] = FlycartWoocommerceOrder::get_shipping_city($order);
2731
  }
2732
  }
2733
+
2734
+ $customer_from_session = FlycartWoocommerceSession::getSession('customer');
2735
+ if(!empty($customer_from_session)){
2736
+ if(isset($customer_from_session[$shippingFieldName])){
2737
+ $postDataArray[$shippingFieldName] = $customer_from_session[$shippingFieldName];
2738
+ } else if(isset($customer_from_session['shipping_postcode'])){
2739
+ $postDataArray['shipping_postcode'] = $customer_from_session['shipping_postcode'];
2740
+ if(empty($postDataArray[$shippingFieldName])){
2741
+ $postDataArray[$shippingFieldName] = $postDataArray['shipping_postcode'];
2742
+ }
2743
+ }
2744
+ }
2745
+
2746
  if(isset($postDataArray[$shippingFieldName]) && $postDataArray[$shippingFieldName] != ''){
2747
  $shippingState = $postDataArray[$shippingFieldName];
2748
  if(in_array(strtolower($shippingState), $rule) || in_array(strtoupper($shippingState), $rule)){
2765
  case 'exclude_categories':
2766
  case 'atleast_one_including_sub_categories':
2767
  case 'in_each_category':
2768
+ $ruleSuccess = $this->validateCartItemsInSelectedProductsAndCategories($index, $rule, $rules, $rules_with_all_data, $rule_sets);
2769
+ if($ruleSuccess){
2770
+ return true;
2771
+ } else {
2772
+ return false;
2773
  }
 
2774
  break;
2775
  case 'customer_based_on_first_order':
2776
  case 'customer_based_on_purchase_history':
2777
  case 'customer_based_on_purchase_history_order_count':
2778
  case 'customer_based_on_purchase_history_product_order_count':
2779
  case 'customer_based_on_purchase_history_product_quantity_count':
2780
+ if($index == 'customer_based_on_first_order'){
2781
+ $rule = array();
2782
+ }
2783
+ if($index == 'customer_based_on_first_order' || count($rule)){
2784
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
2785
  if($ruleSuccess){
2786
  return true;
2842
  public static function getAppliedCoupons(){
2843
  return self::$applied_coupon;
2844
  }
2845
+
2846
+ /**
2847
+ * Format BOGO discount code
2848
+ *
2849
+ * @param $product_name string
2850
+ * @param $quantity integer
2851
+ * @param $product mixed
2852
+ * @param $coupon_code string
2853
+ * @return string
2854
+ * */
2855
+ public static function formatBOGOCouponCode($product_name, $quantity, $product, $coupon_code){
2856
+ $code = str_replace(array('{{product_name}}', '{{quantity}}'), array($product_name, $quantity), $coupon_code);
2857
+ $code = self::filterCouponCode($code);
2858
+ $code = wc_strtolower($code);
2859
+ $code = apply_filters('woo_discount_rules_cart_bogo_coupon_code_based_on_product', $code, $product, $quantity);
2860
+
2861
+ return $code;
2862
+ }
2863
+
2864
+ /**
2865
+ * Filter discount code
2866
+ *
2867
+ * @param $code string
2868
+ * @return string
2869
+ * */
2870
+ public static function filterCouponCode($code){
2871
+ $code = str_replace(array("'", '"'), array('', ''), $code);
2872
+ $code = wc_format_coupon_code($code);
2873
+ return $code;
2874
+ }
2875
  }
2876
  }
includes/discount-base.php CHANGED
@@ -361,9 +361,14 @@ if (!class_exists('FlycartWooDiscountBase')) {
361
  * Has large number of coupons
362
  * */
363
  public static function hasLargeNumberOfCoupon(){
364
- $count = self::getWooCommerceCouponCount();
365
- if($count > 50) return true;
366
- return false;
 
 
 
 
 
367
  }
368
 
369
  /**
@@ -1124,9 +1129,68 @@ if (!class_exists('FlycartWooDiscountBase')) {
1124
  'set_discount' => esc_html__('Bundle (Set) Discount', 'woo-discount-rules'),
1125
  'first_order_discount' => esc_html__('First Order discount', 'woo-discount-rules'),
1126
  'exclude_categories_in_cart' => esc_html__('Exclude categories in cart', 'woo-discount-rules'),
 
 
 
 
 
 
 
 
1127
  );
1128
  }
1129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1130
  /**
1131
  * Remove third party coupon
1132
  * */
@@ -1153,6 +1217,11 @@ if (!class_exists('FlycartWooDiscountBase')) {
1153
  if(!in_array($code, $skip_coupons)){
1154
  $removed_coupon = true;
1155
  FlycartWoocommerceCart::remove_coupon($code);
 
 
 
 
 
1156
  }
1157
  }
1158
  if($removed_coupon){
361
  * Has large number of coupons
362
  * */
363
  public static function hasLargeNumberOfCoupon(){
364
+ $load_coupon_by_search = apply_filters('woo_discount_rules_load_coupon_value_by_search', false);
365
+ if($load_coupon_by_search){
366
+ return true;
367
+ } else {
368
+ $count = self::getWooCommerceCouponCount();
369
+ if($count > 50) return true;
370
+ return false;
371
+ }
372
  }
373
 
374
  /**
1129
  'set_discount' => esc_html__('Bundle (Set) Discount', 'woo-discount-rules'),
1130
  'first_order_discount' => esc_html__('First Order discount', 'woo-discount-rules'),
1131
  'exclude_categories_in_cart' => esc_html__('Exclude categories in cart', 'woo-discount-rules'),
1132
+ 'enable_fixed_item_count_in_bogo' => apply_filters('woo_discount_rules_enable_fixed_item_count_in_bogo', false),
1133
+ 'buy_x_get_x' => esc_html__('Buy X get X (Same product)', 'woo-discount-rules'),
1134
+ 'buy_x_get_y' => esc_html__('Buy X get Y (Auto add all selected products)', 'woo-discount-rules'),
1135
+ 'buy_x_get_x_tool_tip_text' => esc_html__('The customer gets the same product free (Buy 2 get 1 free) or a limited percentage (Buy 2 and get 1 at 50% discount)', 'woo-discount-rules'),
1136
+ 'buy_x_get_y_tool_tip_text' => __('Provide a specific product free when purchasing another product.<br><br>Example: Buy Product A and get Product B free. Product B will be automatically added to cart.', 'woo-discount-rules'),
1137
+ 'more_than_one_cheapest_tool_tip_text' => __('Provide a specific product free when purchasing another product.<br><br>Instead of automatically adding, if you wish to choose the free product, you can select this option.<br><br>Note : Product will be discounted only when the user manually adds the product to cart.', 'woo-discount-rules'),
1138
+ 'more_than_one_cheapest_from_cat_tool_tip_text' => __('Used to provide BOGO discount within categories.<br><br>Example 1: Buy 2 from Category A and get 1 free from the same Category A.<br>Example 2: Buy any items from Category A and get 20% (limited percent) discount on Category B.', 'woo-discount-rules'),
1139
+ 'more_than_one_cheapest_from_all_tool_tip_text' => __('This allows you to offer the cheapest product in cart for free (or at a limited percentage like 50%)', 'woo-discount-rules'),
1140
  );
1141
  }
1142
 
1143
+ /**
1144
+ * Remove applied message for the coupon we are going to remove
1145
+ * */
1146
+ function removeAppliedMessageOfThirdPartyCoupon($msg, $msg_code, $coupon){
1147
+ if(!empty($coupon)){
1148
+ if(method_exists($coupon, 'get_code')){
1149
+ $coupon_code = $coupon->get_code(); //Applied COUPON
1150
+ $do_not_run_while_have_third_party_coupon = $this->getConfigData('do_not_run_while_have_third_party_coupon', 0);
1151
+ if($do_not_run_while_have_third_party_coupon == 'remove_coupon'){
1152
+ $remove_coupon_message = apply_filters('woo_discount_rules_remove_coupon_message_on_apply_discount', true, $coupon_code);
1153
+ if($remove_coupon_message){
1154
+ $has_price_rules = $this->hasPriceRules();
1155
+ $has_cart_rules = $this->hasCartRules();
1156
+ $used_coupons = FlycartWooDiscountRulesGeneralHelper::getUsedCouponsInRules();
1157
+ $applied_coupon = FlycartWooDiscountRulesCartRules::getAppliedCoupons();
1158
+ if(!empty($used_coupons) && is_array($used_coupons)){
1159
+ $applied_coupon = array_merge($applied_coupon, $used_coupons);
1160
+ }
1161
+ if(!empty($applied_coupon)){
1162
+ $applied_coupon = array_map('strtolower', $applied_coupon);
1163
+ }
1164
+ $skip_coupons = apply_filters('woo_discount_rules_coupons_to_skip_while_apply_rules_and_remove_third_party_coupon', $applied_coupon);
1165
+ $cart_discount = $this->getInstance('FlycartWooDiscountRulesCartRules');
1166
+ $skip_coupons[] = $cart_discount->coupon_code;
1167
+ if($has_price_rules || $has_cart_rules){
1168
+ if(!in_array($coupon_code, $skip_coupons)){
1169
+ $msg = '';
1170
+ }
1171
+ } else {
1172
+ global $woocommerce;
1173
+ if(!empty($woocommerce->cart)){
1174
+ if(!empty($woocommerce->cart->applied_coupons)){
1175
+ $coupons_applied = $woocommerce->cart->applied_coupons;
1176
+ if(!empty($coupons_applied)){
1177
+ $used_coupon_in_woo_discount = array_intersect($coupons_applied, $skip_coupons);
1178
+ }
1179
+ if(!empty($used_coupon_in_woo_discount)){
1180
+ if(!in_array($coupon_code, $used_coupon_in_woo_discount)){
1181
+ $msg = '';
1182
+ }
1183
+ }
1184
+ }
1185
+ }
1186
+ }
1187
+ }
1188
+ }
1189
+ }
1190
+ }
1191
+ return $msg;
1192
+ }
1193
+
1194
  /**
1195
  * Remove third party coupon
1196
  * */
1217
  if(!in_array($code, $skip_coupons)){
1218
  $removed_coupon = true;
1219
  FlycartWoocommerceCart::remove_coupon($code);
1220
+ if(function_exists('wc_add_notice')){
1221
+ $msg = sprintf(__('Sorry, it is not possible to apply coupon <b>"%s"</b> as you already have a discount applied in cart.'), $code);
1222
+ $msg = apply_filters('woo_discount_rules_notice_on_remove_coupon_while_having_a_discount', $msg, $code);
1223
+ wc_add_notice( $msg, 'notice' );
1224
+ }
1225
  }
1226
  }
1227
  if($removed_coupon){
includes/pricing-rules.php CHANGED
@@ -1045,7 +1045,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1045
  if(isset($rule['discount'])) {
1046
  if (!empty($rule['discount'])) {
1047
  foreach ($rule['discount'] as $discount_rules) {
1048
- if (isset($discount_rules->discount_type) && $discount_rules->discount_type == 'product_discount') {
1049
  if (isset($discount_rules->discount_product_option) && $discount_rules->discount_product_option == 'all') {
1050
  $has_BOGO = true;
1051
  break;
@@ -1326,7 +1326,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1326
  if (!empty($rule['discount'])) {
1327
  $hasBOGO = 0;
1328
  foreach ($rule['discount'] as $discount_rules) {
1329
- if (isset($discount_rules->discount_type) && $discount_rules->discount_type == 'product_discount') {
1330
  $hasBOGO = 1;
1331
  }
1332
  }
@@ -1388,7 +1388,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1388
  if (!empty($rule['discount'])) {
1389
  $hasBOGO = 0;
1390
  foreach ($rule['discount'] as $discount_rules) {
1391
- if (isset($discount_rules->discount_type) && $discount_rules->discount_type == 'product_discount') {
1392
  $hasBOGO = 1;
1393
  }
1394
  }
@@ -1434,7 +1434,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1434
  if(isset($rule['discount'])){
1435
  if(!empty($rule['discount'])){
1436
  foreach($rule['discount'] as $discount_rules){
1437
- if(isset($discount_rules->discount_type) && $discount_rules->discount_type == 'product_discount'){
1438
  if(!empty($this->matched_sets)){
1439
  foreach($this->matched_sets as $machedRules){
1440
  foreach($machedRules as $machedRule){
@@ -1475,7 +1475,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1475
  if(isset($rule['discount'])){
1476
  if(!empty($rule['discount'])){
1477
  foreach($rule['discount'] as $discount_rules){
1478
- if(isset($discount_rules->discount_type) && $discount_rules->discount_type == 'product_discount'){
1479
  if(!empty($this->matched_sets)){
1480
  foreach($this->matched_sets as $machedRules){
1481
  foreach($machedRules as $machedRule){
@@ -1966,7 +1966,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1966
  }
1967
  } else {
1968
  if ((int)$min <= (int)$quantity && (int)$max >= (int)$quantity) {
1969
- if($type == 'product_discount'){
1970
  $discount_product_option = isset($range->discount_product_option) ? $range->discount_product_option : 'all';
1971
  $productIds = isset($range->discount_product) ? $range->discount_product : array();
1972
  $productIds = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($productIds);
@@ -2224,7 +2224,12 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2224
  $productIds = $this->getAllProductsFromCartAndSelectedCategory($range->discount_category);
2225
 
2226
  for ($i = 1; $i <= $discount_item; $i++){
2227
- $productCheapest = $this->getCheapestProductFromCart($productIds, 0, $discount_quantity, $range, $product_to_exclude);
 
 
 
 
 
2228
  if(!empty($productCheapest)){
2229
  $index = array_search($productCheapest['product'], $productIds);
2230
  if ( $index !== false ) {
@@ -2309,7 +2314,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2309
  /**
2310
  * Get cheapest product
2311
  * */
2312
- public function getCheapestProductFromCart($products, $all = 0, $discount_quantity = 1, $range, $product_to_exclude = array()){
2313
  if(!$all){
2314
  if(empty($products)) return array();
2315
  }
@@ -2325,6 +2330,15 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2325
  if(empty($values['data'])){
2326
  continue;
2327
  }
 
 
 
 
 
 
 
 
 
2328
  //Exclude the bundled products items
2329
  $exclude_bundle_product_item = apply_filters('woo_discount_rules_exclude_woocommerce_bundled_item', true, $values);
2330
  if($exclude_bundle_product_item){
@@ -3291,7 +3305,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3291
  if($discount_type == 'set_discount'){
3292
  $condition = $min;
3293
  }
3294
- if ($discount_type == 'product_discount') {
3295
  $htmlProduct = '';
3296
  $htmlProduct .= esc_html__('Get ', 'woo-discount-rules');
3297
  if($discount_product_discount_type == "limited_percent" && $discount_product_percent>0){
@@ -3348,8 +3362,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3348
 
3349
  }
3350
  $dataReturn[$index.$id]['title'] = $title;
3351
- $dataReturn[$index.$id]['condition'] = $condition;
3352
- $dataReturn[$index.$id]['discount'] = $discount;
3353
  }
3354
  }
3355
  }
@@ -3409,7 +3423,6 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3409
  if(!empty($cart_item_key) && !empty($woocommerce->cart->cart_contents[$cart_item_key])){
3410
  $woocommerce->cart->cart_contents[$cart_item_key]['woo_discount'] = array();
3411
  }
3412
-
3413
  // If Product having the rule sets then,
3414
  if (!isset($this->matched_sets[$cart_item_key])) return false;
3415
  if (empty($this->matched_sets[$cart_item_key])) return false;
@@ -4885,5 +4898,19 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
4885
 
4886
  return $html;
4887
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4888
  }
4889
  }
1045
  if(isset($rule['discount'])) {
1046
  if (!empty($rule['discount'])) {
1047
  foreach ($rule['discount'] as $discount_rules) {
1048
+ if (isset($discount_rules->discount_type) && self::isBOGODiscount($discount_rules->discount_type)) {
1049
  if (isset($discount_rules->discount_product_option) && $discount_rules->discount_product_option == 'all') {
1050
  $has_BOGO = true;
1051
  break;
1326
  if (!empty($rule['discount'])) {
1327
  $hasBOGO = 0;
1328
  foreach ($rule['discount'] as $discount_rules) {
1329
+ if (isset($discount_rules->discount_type) && self::isBOGODiscount($discount_rules->discount_type)) {
1330
  $hasBOGO = 1;
1331
  }
1332
  }
1388
  if (!empty($rule['discount'])) {
1389
  $hasBOGO = 0;
1390
  foreach ($rule['discount'] as $discount_rules) {
1391
+ if (isset($discount_rules->discount_type) && self::isBOGODiscount($discount_rules->discount_type)) {
1392
  $hasBOGO = 1;
1393
  }
1394
  }
1434
  if(isset($rule['discount'])){
1435
  if(!empty($rule['discount'])){
1436
  foreach($rule['discount'] as $discount_rules){
1437
+ if(isset($discount_rules->discount_type) && self::isBOGODiscount($discount_rules->discount_type)){
1438
  if(!empty($this->matched_sets)){
1439
  foreach($this->matched_sets as $machedRules){
1440
  foreach($machedRules as $machedRule){
1475
  if(isset($rule['discount'])){
1476
  if(!empty($rule['discount'])){
1477
  foreach($rule['discount'] as $discount_rules){
1478
+ if(isset($discount_rules->discount_type) && self::isBOGODiscount($discount_rules->discount_type)){
1479
  if(!empty($this->matched_sets)){
1480
  foreach($this->matched_sets as $machedRules){
1481
  foreach($machedRules as $machedRule){
1966
  }
1967
  } else {
1968
  if ((int)$min <= (int)$quantity && (int)$max >= (int)$quantity) {
1969
+ if(self::isBOGODiscount($type)){
1970
  $discount_product_option = isset($range->discount_product_option) ? $range->discount_product_option : 'all';
1971
  $productIds = isset($range->discount_product) ? $range->discount_product : array();
1972
  $productIds = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($productIds);
2224
  $productIds = $this->getAllProductsFromCartAndSelectedCategory($range->discount_category);
2225
 
2226
  for ($i = 1; $i <= $discount_item; $i++){
2227
+ if(!isset($adjustment['product_cart_item_keys'])){
2228
+ $adjustment_product_cart_item_keys = array();
2229
+ } else {
2230
+ $adjustment_product_cart_item_keys = $adjustment['product_cart_item_keys'];
2231
+ }
2232
+ $productCheapest = $this->getCheapestProductFromCart($productIds, 0, $discount_quantity, $range, $product_to_exclude, $adjustment_product_cart_item_keys);
2233
  if(!empty($productCheapest)){
2234
  $index = array_search($productCheapest['product'], $productIds);
2235
  if ( $index !== false ) {
2314
  /**
2315
  * Get cheapest product
2316
  * */
2317
+ public function getCheapestProductFromCart($products, $all = 0, $discount_quantity = 1, $range, $product_to_exclude = array(), $adjustment_product_cart_item_keys = array()){
2318
  if(!$all){
2319
  if(empty($products)) return array();
2320
  }
2330
  if(empty($values['data'])){
2331
  continue;
2332
  }
2333
+ $exclude_cart_item_which_has_discount = apply_filters('woo_discount_rules_exclude_cart_item_which_has_discount_already', false, $cart_item_key, $values, $cart);
2334
+ if($exclude_cart_item_which_has_discount){
2335
+ if(!empty($adjustment_product_cart_item_keys)){
2336
+ if(in_array($cart_item_key, $adjustment_product_cart_item_keys)){
2337
+ continue;
2338
+ }
2339
+ }
2340
+ }
2341
+
2342
  //Exclude the bundled products items
2343
  $exclude_bundle_product_item = apply_filters('woo_discount_rules_exclude_woocommerce_bundled_item', true, $values);
2344
  if($exclude_bundle_product_item){
3305
  if($discount_type == 'set_discount'){
3306
  $condition = $min;
3307
  }
3308
+ if (self::isBOGODiscount($discount_type)) {
3309
  $htmlProduct = '';
3310
  $htmlProduct .= esc_html__('Get ', 'woo-discount-rules');
3311
  if($discount_product_discount_type == "limited_percent" && $discount_product_percent>0){
3362
 
3363
  }
3364
  $dataReturn[$index.$id]['title'] = $title;
3365
+ $dataReturn[$index.$id]['condition'] = apply_filters('woo_discount_rules_table_content_condition_html', $condition, $value);
3366
+ $dataReturn[$index.$id]['discount'] = apply_filters('woo_discount_rules_table_content_discount_html', $discount, $value->discount_type, $value->to_discount, $value);
3367
  }
3368
  }
3369
  }
3423
  if(!empty($cart_item_key) && !empty($woocommerce->cart->cart_contents[$cart_item_key])){
3424
  $woocommerce->cart->cart_contents[$cart_item_key]['woo_discount'] = array();
3425
  }
 
3426
  // If Product having the rule sets then,
3427
  if (!isset($this->matched_sets[$cart_item_key])) return false;
3428
  if (empty($this->matched_sets[$cart_item_key])) return false;
4898
 
4899
  return $html;
4900
  }
4901
+
4902
+ /**
4903
+ * Is BOGO discount
4904
+ *
4905
+ * @param $discount_type string
4906
+ * @return boolean
4907
+ * */
4908
+ public static function isBOGODiscount($discount_type){
4909
+ if(in_array($discount_type, array('product_discount', 'buy_x_get_x', 'buy_x_get_y', 'more_than_one_cheapest', 'more_than_one_cheapest_from_cat', 'more_than_one_cheapest_from_all'))){
4910
+ return true;
4911
+ }
4912
+
4913
+ return false;
4914
+ }
4915
  }
4916
  }
loader.php CHANGED
@@ -380,6 +380,8 @@ if(!class_exists('FlycartWooDiscountRules')){
380
 
381
  add_action('woocommerce_after_calculate_totals', array($this->discountBase, 'removeThirdPartyCoupon'), 20);
382
 
 
 
383
  add_action('woocommerce_add_to_cart', array($this->pricingRules, 'handleBOGODiscount'), 10, 6);
384
 
385
  $add_free_product_on_coupon_applied = $this->discountBase->getConfigData('add_free_product_on_coupon_applied', 0);
380
 
381
  add_action('woocommerce_after_calculate_totals', array($this->discountBase, 'removeThirdPartyCoupon'), 20);
382
 
383
+ add_filter('woocommerce_coupon_message', array($this->discountBase, 'removeAppliedMessageOfThirdPartyCoupon'), 10, 3);
384
+
385
  add_action('woocommerce_add_to_cart', array($this->pricingRules, 'handleBOGODiscount'), 10, 6);
386
 
387
  $add_free_product_on_coupon_applied = $this->discountBase->getConfigData('add_free_product_on_coupon_applied', 0);
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.3
7
- Stable tag: 1.8.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -336,6 +336,29 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  = 1.8.2 - 14/11/19 =
340
  * Feature - Option to display promotion message in cart about the upcoming discount (Subtotal based).
341
  * Improvement - Upgrading to pro option in deactivation survey.
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.3
7
+ Stable tag: 1.9.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
336
 
337
  == Changelog ==
338
 
339
+ = 1.9.0 - 17/12/19 =
340
+ * Improvement - Moved BOGO options to adjustment type for user friendly.
341
+ * Improvement - Display time Hours in 24 hours.
342
+ * Improvement - Remove special character for BOGO coupon.
343
+ * Improvement - Load shipping info from session if post value doesn't exists.
344
+ * Improvement - Don't allow to repeat same condition again in cart rule while adding rules.
345
+ * Improvement - To display message on failed to apply coupon when discount applied through Woo Discount plugin(based on settings).
346
+ * Improvement - Event: apply_filters('woo_discount_rules_table_content_condition_html', $condition, $value);
347
+ * Improvement - Event: apply_filters('woo_discount_rules_table_content_discount_html', $discount, $value->discount_type, $value->to_discount, $value);
348
+ * Improvement - Event: apply_filters('woo_discount_rules_exclude_cart_item_which_has_discount_already', false, $cart_item_key, $values, $cart);
349
+ * Improvement - Event: apply_filters('woo_discount_rules_load_coupon_value_by_search', false);
350
+ * Improvement - Event: apply_filters('woo_discount_rules_cart_bogo_coupon_code', '{{product_name}} X {{quantity}}');
351
+ * Improvement - Event: apply_filters('woo_discount_rules_notice_on_remove_coupon_while_having_a_discount', $msg, $code);
352
+ * Improvement - Event: apply_filters('woo_discount_rules_remove_coupon_message_on_apply_discount', true, $coupon_code);
353
+ * Fix - Wrong coupon name while having multiple create coupon option rules is set.
354
+ * Fix - Each category option in cart rule is not working.
355
+ * Fix - Warning due to the method doesn't exists wc_strtoupper.
356
+ * Fix - Changed discount type for free product in cart option.
357
+ * Fix - Free shipping based on shipping state doesn't works when update the cart item.
358
+ * Fix - Warning issue when exclude sale option is enabled in cart rules.
359
+ * Fix - Remove cart rule BOGO when third-party coupon applied(based on settings).
360
+ * Fix - Warning on having first order discount in cart rules.
361
+
362
  = 1.8.2 - 14/11/19 =
363
  * Feature - Option to display promotion message in cart about the upcoming discount (Subtotal based).
364
  * Improvement - Upgrading to pro option in deactivation survey.
view/cart-rules.php CHANGED
@@ -49,8 +49,8 @@ $current_language = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
49
  </div>
50
  <div class="col-md-4 text-right">
51
  <br/>
52
- <a href="https://www.flycart.org/woocommerce-discount-rules-examples#cartdiscountexample" target="_blank" class="btn btn-info"><?php esc_html_e('View Examples', 'woo-discount-rules'); ?></a>
53
- <a href="http://docs.flycart.org/woocommerce-discount-rules/cart-discount-rules" target="_blank" class="btn btn-info"><?php esc_html_e('Documentation', 'woo-discount-rules'); ?></a>
54
  </div>
55
  <hr>
56
  </div>
@@ -138,7 +138,22 @@ $current_language = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
138
  <th class="check-column">
139
  <input id="cb-select-<?php echo $i; ?>" name="post[]" value="<?php echo $rule->ID; ?>" type="checkbox"/>
140
  </th>
141
- <td><?php echo(isset($meta['rule_name'][0]) ? $meta['rule_name'][0] : '-') ?></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  <td><?php echo(isset($rule->date_from) ? $rule->date_from : '-') ?></td>
143
  <td><?php echo(isset($rule->date_to) ? $rule->date_to : '-') ?></td>
144
  <td class="status_in_text" id="status_in_text_<?php echo $rule->ID ?>"><?php
49
  </div>
50
  <div class="col-md-4 text-right">
51
  <br/>
52
+ <a href="https://www.flycart.org/woocommerce-discount-rules-examples?utm_source=woo-discount-rules&utm_campaign=doc&utm_medium=text-click&utm_content=example_cart_rules#cartdiscountexample" target="_blank" class="btn btn-info"><?php esc_html_e('View Examples', 'woo-discount-rules'); ?></a>
53
+ <a href="http://docs.flycart.org/woocommerce-discount-rules/cart-discount-rules?utm_source=woo-discount-rules&utm_campaign=doc&utm_medium=text-click&utm_content=documentation_cart_rules" target="_blank" class="btn btn-info"><?php esc_html_e('Documentation', 'woo-discount-rules'); ?></a>
54
  </div>
55
  <hr>
56
  </div>
138
  <th class="check-column">
139
  <input id="cb-select-<?php echo $i; ?>" name="post[]" value="<?php echo $rule->ID; ?>" type="checkbox"/>
140
  </th>
141
+ <td>
142
+ <div class="wdr_rule_title">
143
+ <a href="?page=woo_discount_rules&tab=cart-rules&view=<?php echo $rule->ID ?>">
144
+ <?php echo (isset($meta['rule_name'][0]) ? $meta['rule_name'][0] : '-'); ?>
145
+ </a>
146
+ </div>
147
+ <?php
148
+ if(isset($rule->rule_descr) && !empty($rule->rule_descr)){
149
+ ?>
150
+ <div class="wdr_desc_text">
151
+ <?php echo $rule->rule_descr; ?>
152
+ </div>
153
+ <?php
154
+ }
155
+ ?>
156
+ </td>
157
  <td><?php echo(isset($rule->date_from) ? $rule->date_from : '-') ?></td>
158
  <td><?php echo(isset($rule->date_to) ? $rule->date_to : '-') ?></td>
159
  <td class="status_in_text" id="status_in_text_<?php echo $rule->ID ?>"><?php
view/pricing-rules.php CHANGED
@@ -81,8 +81,8 @@ $current_language = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
81
  </div>
82
  <div class="col-md-4 text-right">
83
  <br/>
84
- <a href="https://www.flycart.org/woocommerce-discount-rules-examples#pricediscountexample" target="_blank" class="btn btn-info"><?php esc_html_e('View Examples', 'woo-discount-rules'); ?></a>
85
- <a href="http://docs.flycart.org/woocommerce-discount-rules/price-discount-rules" target="_blank" class="btn btn-info"><?php esc_html_e('Documentation', 'woo-discount-rules'); ?></a>
86
  </div>
87
  <hr>
88
  </div>
@@ -117,7 +117,7 @@ $current_language = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
117
  </div>
118
  </div>
119
  <br>
120
- <div class="row">
121
  <div class="">
122
  <table class="wp-list-table widefat fixed striped posts">
123
  <thead>
@@ -168,7 +168,22 @@ $current_language = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
168
  <th class="check-column">
169
  <input id="cb-select-<?php echo $i; ?>" name="post[]" value="<?php echo $rule->ID; ?>" type="checkbox"/>
170
  </th>
171
- <td><?php echo(isset($rule->rule_name) ? $rule->rule_name : '-') ?></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  <td><?php echo(isset($rule->date_from) ? $rule->date_from : '-') ?></td>
173
  <td><?php echo(isset($rule->date_to) ? $rule->date_to : '-') ?></td>
174
  <td class="status_in_text" id="status_in_text_<?php echo $rule->ID ?>"><?php
81
  </div>
82
  <div class="col-md-4 text-right">
83
  <br/>
84
+ <a href="https://www.flycart.org/woocommerce-discount-rules-examples?utm_source=woo-discount-rules&utm_campaign=doc&utm_medium=text-click&utm_content=example_price_rules#pricediscountexample" target="_blank" class="btn btn-info"><?php esc_html_e('View Examples', 'woo-discount-rules'); ?></a>
85
+ <a href="http://docs.flycart.org/woocommerce-discount-rules/price-discount-rules?utm_source=woo-discount-rules&utm_campaign=doc&utm_medium=text-click&utm_content=documentation" target="_blank" class="btn btn-info"><?php esc_html_e('Documentation', 'woo-discount-rules'); ?></a>
86
  </div>
87
  <hr>
88
  </div>
117
  </div>
118
  </div>
119
  <br>
120
+ <div class="row wdr_price_rule_listing_table_con">
121
  <div class="">
122
  <table class="wp-list-table widefat fixed striped posts">
123
  <thead>
168
  <th class="check-column">
169
  <input id="cb-select-<?php echo $i; ?>" name="post[]" value="<?php echo $rule->ID; ?>" type="checkbox"/>
170
  </th>
171
+ <td>
172
+ <div class="wdr_rule_title">
173
+ <a href="?page=woo_discount_rules&view=<?php echo $rule->ID ?>">
174
+ <?php echo (isset($rule->rule_name) ? $rule->rule_name : '-'); ?>
175
+ </a>
176
+ </div>
177
+ <?php
178
+ if(isset($rule->rule_descr) && !empty($rule->rule_descr)){
179
+ ?>
180
+ <div class="wdr_desc_text">
181
+ <?php echo $rule->rule_descr; ?>
182
+ </div>
183
+ <?php
184
+ }
185
+ ?>
186
+ </td>
187
  <td><?php echo(isset($rule->date_from) ? $rule->date_from : '-') ?></td>
188
  <td><?php echo(isset($rule->date_to) ? $rule->date_to : '-') ?></td>
189
  <td class="status_in_text" id="status_in_text_<?php echo $rule->ID ?>"><?php
view/view-cart-rules.php CHANGED
@@ -137,7 +137,7 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
137
  class="form-control wdr_datepicker"
138
  value="<?php echo $date_to; ?>"
139
  placeholder="<?php esc_attr_e('To', 'woo-discount-rules'); ?>"></div>
140
- <span class="wdr_current_date_and_time_string"><?php echo sprintf(esc_html__('Current date and time: %s', 'woo-discount-rules'), date('m/d/Y h:i', strtotime($current_date_and_time))); ?></span>
141
  </div>
142
  </div>
143
  </div>
137
  class="form-control wdr_datepicker"
138
  value="<?php echo $date_to; ?>"
139
  placeholder="<?php esc_attr_e('To', 'woo-discount-rules'); ?>"></div>
140
+ <span class="wdr_current_date_and_time_string"><?php echo sprintf(esc_html__('Current date and time: %s', 'woo-discount-rules'), date('m/d/Y H:i', strtotime($current_date_and_time))); ?></span>
141
  </div>
142
  </div>
143
  </div>
view/view-pricing-rules.php CHANGED
@@ -146,7 +146,7 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
146
  class="form-control wdr_datepicker"
147
  value="<?php echo $date_to; ?>"
148
  placeholder="<?php esc_attr_e('To - Leave Empty if No Expiry', 'woo-discount-rules'); ?>"></div>
149
- <span class="wdr_current_date_and_time_string"><?php echo sprintf(esc_html__('Current date and time: %s', 'woo-discount-rules'), date('m/d/Y h:i', strtotime($current_date_and_time))); ?></span>
150
  </div>
151
  </div>
152
  <?php
@@ -748,13 +748,53 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
748
  <?php } ?>
749
  </option>
750
  <option
751
- <?php if (!$pro) { ?> disabled <?php } else { ?> value="product_discount" <?php
752
  }
753
- if ($opt == 'product_discount') { ?> selected=selected <?php } ?>>
754
  <?php if (!$pro) { ?>
755
- <?php esc_html_e('BOGO Product Discount', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
756
  <?php } else { ?>
757
- <?php esc_html_e('BOGO Product Discount', 'woo-discount-rules'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  <?php } ?>
759
  </option>
760
  </select></label>
@@ -784,15 +824,15 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
784
  }
785
  ?>
786
  <div class="price_discount_product_list_con">
787
- <?php esc_html_e('receive discount for', 'woo-discount-rules') ?>
788
- <select class="selectpicker discount_product_option" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_option]">
789
  <option value="all"<?php echo ($discount_product_option == 'all')? ' selected="selected"': '' ?>><?php esc_html_e('Auto add all selected products', 'woo-discount-rules') ?></option>
790
  <option value="same_product"<?php echo ($discount_product_option == 'same_product')? ' selected="selected"': '' ?>><?php esc_html_e('Same product', 'woo-discount-rules') ?></option>
791
  <option value="more_than_one_cheapest_from_cat"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_cat')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected category(ies)', 'woo-discount-rules') ?></option>
792
  <option value="more_than_one_cheapest"<?php echo ($discount_product_option == 'more_than_one_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected item(s)', 'woo-discount-rules') ?></option>
793
  <option value="more_than_one_cheapest_from_all"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest among all items in cart', 'woo-discount-rules') ?></option>
794
  </select>
795
- <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('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'); ?>"></span>
796
  <div class="discount_product_option_bogo_con hide">
797
  <label><?php esc_html_e('Free quantity', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Number of quantity(ies) in each selected product(s)', 'woo-discount-rules'); ?>"></span>
798
  <input type="text"
@@ -805,12 +845,18 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
805
  <div class="discount_product_option_more_cheapest_con hide">
806
  <?php
807
  $discount_product_item_type = (isset($discount->discount_product_item_type) ? $discount->discount_product_item_type : 'dynamic');
 
 
 
 
 
 
808
  ?>
809
- <select class="selectpicker discount_product_item_count_type" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_item_type]">
810
  <option value="dynamic"<?php echo ($discount_product_item_type == 'dynamic')? ' selected="selected"': '' ?>><?php esc_html_e('Dynamic item count', 'woo-discount-rules') ?></option>
811
  <option value="static"<?php echo ($discount_product_item_type == 'static')? ' selected="selected"': '' ?>><?php esc_html_e('Fixed item count (not recommended)', 'woo-discount-rules') ?></option>
812
  </select>
813
- <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Fixed item count - You need to provide item count manually. Dynamic item count - System will choose dynamically based on cart', 'woo-discount-rules'); ?>"></span>
814
  <label class="discount_product_items_count_field"><?php esc_html_e('Item count', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Discount for number of item(s) in cart', 'woo-discount-rules'); ?>"></span>
815
  <input type="text"
816
  name="discount_range[<?php echo $fieldIndex; ?>][discount_product_items]"
146
  class="form-control wdr_datepicker"
147
  value="<?php echo $date_to; ?>"
148
  placeholder="<?php esc_attr_e('To - Leave Empty if No Expiry', 'woo-discount-rules'); ?>"></div>
149
+ <span class="wdr_current_date_and_time_string"><?php echo sprintf(esc_html__('Current date and time: %s', 'woo-discount-rules'), date('m/d/Y H:i', strtotime($current_date_and_time))); ?></span>
150
  </div>
151
  </div>
152
  <?php
748
  <?php } ?>
749
  </option>
750
  <option
751
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="buy_x_get_x" <?php
752
  }
753
+ if ($opt == 'buy_x_get_x') { ?> selected=selected <?php } ?>>
754
  <?php if (!$pro) { ?>
755
+ <?php esc_html_e('Buy X get X (Same product)', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
756
  <?php } else { ?>
757
+ <?php esc_html_e('Buy X get X (Same product)', 'woo-discount-rules'); ?>
758
+ <?php } ?>
759
+ </option>
760
+ <option
761
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="buy_x_get_y" <?php
762
+ }
763
+ if ($opt == 'buy_x_get_y') { ?> selected=selected <?php } ?>>
764
+ <?php if (!$pro) { ?>
765
+ <?php esc_html_e('Buy X get Y (Auto add all selected products)', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
766
+ <?php } else { ?>
767
+ <?php esc_html_e('Buy X get Y (Auto add all selected products)', 'woo-discount-rules'); ?>
768
+ <?php } ?>
769
+ </option>
770
+ <option
771
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="more_than_one_cheapest" <?php
772
+ }
773
+ if ($opt == 'more_than_one_cheapest') { ?> selected=selected <?php } ?>>
774
+ <?php if (!$pro) { ?>
775
+ <?php esc_html_e('Cheapest in cart - selected item(s)', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
776
+ <?php } else { ?>
777
+ <?php esc_html_e('Cheapest in cart - selected item(s)', 'woo-discount-rules'); ?>
778
+ <?php } ?>
779
+ </option>
780
+ <option
781
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="more_than_one_cheapest_from_cat" <?php
782
+ }
783
+ if ($opt == 'more_than_one_cheapest_from_cat') { ?> selected=selected <?php } ?>>
784
+ <?php if (!$pro) { ?>
785
+ <?php esc_html_e('Cheapest in cart - selected category(ies)', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
786
+ <?php } else { ?>
787
+ <?php esc_html_e('Cheapest in cart - selected category(ies)', 'woo-discount-rules'); ?>
788
+ <?php } ?>
789
+ </option>
790
+ <option
791
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="more_than_one_cheapest_from_all" <?php
792
+ }
793
+ if ($opt == 'more_than_one_cheapest_from_all') { ?> selected=selected <?php } ?>>
794
+ <?php if (!$pro) { ?>
795
+ <?php esc_html_e('Cheapest among all items in cart', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
796
+ <?php } else { ?>
797
+ <?php esc_html_e('Cheapest among all items in cart', 'woo-discount-rules'); ?>
798
  <?php } ?>
799
  </option>
800
  </select></label>
824
  }
825
  ?>
826
  <div class="price_discount_product_list_con">
827
+ <span class="bogo_receive_discount_for_text"><?php esc_html_e('receive discount for', 'woo-discount-rules') ?></span>
828
+ <select class="discount_product_option" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_option]">
829
  <option value="all"<?php echo ($discount_product_option == 'all')? ' selected="selected"': '' ?>><?php esc_html_e('Auto add all selected products', 'woo-discount-rules') ?></option>
830
  <option value="same_product"<?php echo ($discount_product_option == 'same_product')? ' selected="selected"': '' ?>><?php esc_html_e('Same product', 'woo-discount-rules') ?></option>
831
  <option value="more_than_one_cheapest_from_cat"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_cat')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected category(ies)', 'woo-discount-rules') ?></option>
832
  <option value="more_than_one_cheapest"<?php echo ($discount_product_option == 'more_than_one_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest in cart - selected item(s)', 'woo-discount-rules') ?></option>
833
  <option value="more_than_one_cheapest_from_all"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('Cheapest among all items in cart', 'woo-discount-rules') ?></option>
834
  </select>
835
+ <span class="woocommerce-help-tip discount_product_option_hint" data-tip="<?php esc_attr_e('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'); ?>"></span>
836
  <div class="discount_product_option_bogo_con hide">
837
  <label><?php esc_html_e('Free quantity', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Number of quantity(ies) in each selected product(s)', 'woo-discount-rules'); ?>"></span>
838
  <input type="text"
845
  <div class="discount_product_option_more_cheapest_con hide">
846
  <?php
847
  $discount_product_item_type = (isset($discount->discount_product_item_type) ? $discount->discount_product_item_type : 'dynamic');
848
+ $enable_fixed_item_count_in_bogo = apply_filters('woo_discount_rules_enable_fixed_item_count_in_bogo', false);
849
+ $discount_product_item_count_type_class = ' selectpicker';
850
+ $discount_product_item_count_type_hint_class = '';
851
+ if($enable_fixed_item_count_in_bogo == false){
852
+ $discount_product_item_count_type_hint_class = $discount_product_item_count_type_class = ' hide_discount_product_item_count_type';
853
+ }
854
  ?>
855
+ <select class="discount_product_item_count_type<?php echo $discount_product_item_count_type_class; ?>" name="discount_range[<?php echo $fieldIndex; ?>][discount_product_item_type]">
856
  <option value="dynamic"<?php echo ($discount_product_item_type == 'dynamic')? ' selected="selected"': '' ?>><?php esc_html_e('Dynamic item count', 'woo-discount-rules') ?></option>
857
  <option value="static"<?php echo ($discount_product_item_type == 'static')? ' selected="selected"': '' ?>><?php esc_html_e('Fixed item count (not recommended)', 'woo-discount-rules') ?></option>
858
  </select>
859
+ <span class="woocommerce-help-tip<?php echo $discount_product_item_count_type_hint_class; ?>" data-tip="<?php esc_attr_e('Fixed item count - You need to provide item count manually. Dynamic item count - System will choose dynamically based on cart', 'woo-discount-rules'); ?>"></span>
860
  <label class="discount_product_items_count_field"><?php esc_html_e('Item count', 'woo-discount-rules'); ?> <span class="woocommerce-help-tip" data-tip="<?php esc_attr_e('Discount for number of item(s) in cart', 'woo-discount-rules'); ?>"></span>
861
  <input type="text"
862
  name="discount_range[<?php echo $fieldIndex; ?>][discount_product_items]"
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.8.2
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.9.0
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/