Discount Rules for WooCommerce - Version 1.7.20

Version Description

  • 23/09/19 =
  • Feature - Option for Product in list, Exclude product, Exclude on sale product in cart rules.
  • Feature - Duration option(Last 7 days, 14 days, 30 days, 60 days, 90 days, 180 days, 1 year, Custom) in purchase history based rules.
  • Improvement - Include variant while parent product is selected in Purchase history based rule.
  • Improvement - Send params in JS event woo_discount_rules_after_display_strikeout_price_on_quantity_update.
  • Improvement - Not to trigger ajax for loading discount table if table is disabled.
  • Improvement - Dynamic strikeout improvement to change the price for variable product header price while having single price for all variants.
  • Improvement - Event apply_filters('woo_discount_rules_class_to_refresh_the_checkout_review_on_blur', 'input#billing_email, select#billing_state');
  • Improvement - Display update notice through update check when there is no update available.
  • Fix - Not displaying sale price with strike out because of sale adjustment handled by Woo discount plugin.
Download this release

Release Info

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

Code changes from version 1.7.19 to 1.7.20

assets/js/app.js CHANGED
@@ -593,6 +593,7 @@ function trigger_woocommerce_tooltip(){
593
  $(document).on('click', '#add_cart_rule', function () {
594
  var count = $('.cart_rules_list').length;
595
  var product_list = '';
 
596
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
597
  $.ajax({
598
  url: ajax_url,
@@ -610,6 +611,22 @@ function trigger_woocommerce_tooltip(){
610
  $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
611
  }
612
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613
 
614
  // Cloning the List.
615
  var user_list = $('#cart_user_list_0 > option').clone();
@@ -622,6 +639,11 @@ function trigger_woocommerce_tooltip(){
622
  var form = '<div class="cart_rules_list row"> <div class="col-md-3 form-group"> <label>'+woo_discount_localization.type_text+' <select class="form-control cart_rule_type" id="cart_condition_type_' + count + '" name="discount_rule[' + count + '][type]"> <optgroup label="'+woo_discount_localization.cart_subtotal+'"><option value="subtotal_least" selected="selected">'+woo_discount_localization.subtotal_at_least+'</option><option value="subtotal_less">'+woo_discount_localization.subtotal_less_than+'</option></optgroup>' +
623
  '<optgroup label="'+woo_discount_localization.cart_item_count+'"><option value="item_count_least">'+woo_discount_localization.number_of_line_items_in_cart_at_least+'</option><option value="item_count_less">'+woo_discount_localization.number_of_line_items_in_cart_less_than+'</option></optgroup>' +
624
  '<optgroup label="'+woo_discount_localization.quantity_sum+'"><option value="quantity_least">'+woo_discount_localization.total_number_of_quantities_in_cart_at_least+'</option><option value="quantity_less">'+woo_discount_localization.total_number_of_quantities_in_cart_less_than+'</option></optgroup>' +
 
 
 
 
 
625
  '<optgroup label="'+woo_discount_localization.categories_in_cart+'">' +
626
  '<option value="categories_in">'+woo_discount_localization.categories_in_cart+'</option>' +
627
  '<option value="atleast_one_including_sub_categories">'+woo_discount_localization.atleast_one_including_sub_categories+'</option>' +
@@ -637,10 +659,11 @@ function trigger_woocommerce_tooltip(){
637
  '<option value="customer_based_on_purchase_history">'+woo_discount_localization.purchased_amount+'</option>'+
638
  '<option value="customer_based_on_purchase_history_order_count">'+woo_discount_localization.number_of_order_purchased+'</option>'+
639
  '<option value="customer_based_on_purchase_history_product_order_count">'+woo_discount_localization.number_of_order_purchased_in_product+'</option>'+
 
640
  '</optgroup>' +
641
  '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option value="coupon_applied_any_one">'+woo_discount_localization.atleast_any_one+'</option><option value="coupon_applied_all_selected">'+woo_discount_localization.all_selected_coupon+'</option></optgroup>' +
642
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
643
- '<div class="col-md-3 form-group"><label> '+woo_discount_localization.value_text+'<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
644
  '<div id="user_div_' + count + '">';
645
  if($('#flycart_wdr_woocommerce_version').val() == 2){
646
  form += '<input class="wc-customer-search" style="width: 250px" name="discount_rule[' + count + '][users_to_apply][]" data-placeholder="'+woo_discount_localization.place_holder_search_for_a_user+'"/>';
@@ -649,6 +672,8 @@ function trigger_woocommerce_tooltip(){
649
  }
650
  form += '</div>' +
651
  '<div id="product_div_' + count + '"><select id="cart_product_list_' + count + '" class="product_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][product_to_apply][]"></select></div>' +
 
 
652
  '<div id="category_div_' + count + '"><select id="cart_category_list_' + count + '" class="category_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][category_to_apply][]"></select></div>';
653
  if($('#has_large_number_of_coupon').val() == 1){
654
  form += '<div id="coupon_div_' + count + '"><select id="cart_coupon_list_' + count + '" class="coupons_selectbox_multi_select_wdr" multiple name="discount_rule[' + count + '][coupon_to_apply][]"></select></div>';
@@ -664,13 +689,33 @@ function trigger_woocommerce_tooltip(){
664
  '<option value="atleast">'+woo_discount_localization.greater_than_or_equal_to+'</option>' +
665
  '<option value="less_than_or_equal">'+woo_discount_localization.less_than_or_equal_to+'</option>' +
666
  '</select>' +
667
- ' <input name="discount_rule[' + count + '][purchased_history_amount]" value="" type="text"/> '+woo_discount_localization.in_order_status+' <select id="order_status_list_' + count + '" class="order_status_list selectpicker" data-live-search="true" multiple name="discount_rule[' + count + '][purchase_history_order_status][]"></select></div>' +
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
  '</div><div class="col-md-1"> <label> '+woo_discount_localization.action_text+'</label> <br> <a href=javascript:void(0) class="btn btn-danger remove_cart_rule">'+woo_discount_localization.remove_text+'</a> </div>' +
669
  '</label></div>';
670
  } else {
671
  var form = '<div class="cart_rules_list row"> <div class="col-md-3 form-group"> <label>'+woo_discount_localization.type_text+' <select class="form-control cart_rule_type" id="cart_condition_type_' + count + '" name="discount_rule[' + count + '][type]"> <optgroup label="'+woo_discount_localization.cart_subtotal+'"><option value="subtotal_least" selected="selected">'+woo_discount_localization.subtotal_at_least+'</option><option value="subtotal_less">'+woo_discount_localization.subtotal_less_than+'</option></optgroup>' +
672
  '<optgroup label="'+woo_discount_localization.cart_item_count+'"><option value="item_count_least">'+woo_discount_localization.number_of_line_items_in_cart_at_least+'</option><option value="item_count_less">'+woo_discount_localization.number_of_line_items_in_cart_less_than+'</option></optgroup>' +
673
  '<optgroup label="'+woo_discount_localization.quantity_sum+'"><option disabled>'+woo_discount_localization.total_number_of_quantities_in_cart_at_least+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.total_number_of_quantities_in_cart_less_than+' <b>' + pro_suffix + '</b></option></optgroup>' +
 
 
 
 
 
674
  '<optgroup label="'+woo_discount_localization.categories_in_cart+'">' +
675
  '<option disabled>'+woo_discount_localization.categories_in_cart+' <b>' + pro_suffix + '</b></option>' +
676
  '<option disabled>'+woo_discount_localization.atleast_one_including_sub_categories+' <b>' + pro_suffix + '</b></option>' +
@@ -688,7 +733,7 @@ function trigger_woocommerce_tooltip(){
688
  '</optgroup>' +
689
  '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option disabled>'+woo_discount_localization.atleast_any_one+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.all_selected+' <b>' + pro_suffix + '</b></option></optgroup>' +
690
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
691
- '<div class="col-md-3 form-group"><label> '+woo_discount_localization.value_text+'<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
692
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
693
  '<div id="product_div_' + count + '"><select id="cart_product_list_' + count + '" class="product_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][product_to_apply][]"></select></div>' +
694
  '<div id="category_div_' + count + '"><select id="cart_category_list_' + count + '" class="category_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][category_to_apply][]"></select></div>' +
@@ -705,6 +750,10 @@ function trigger_woocommerce_tooltip(){
705
  $('#purchase_history_products_list_'+count).html(product_list);
706
  $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
707
  }
 
 
 
 
708
 
709
  $('.wc-customer-search').trigger( 'wc-enhanced-select-init' );
710
  $('.coupons_selectbox_multi_select_wdr').trigger('trigger_ajax_select_wdr');
@@ -712,18 +761,22 @@ function trigger_woocommerce_tooltip(){
712
  // Append the List of Values.
713
  $('#cart_user_list_' + count).append(user_list);
714
  $('#cart_product_list_' + count).append(product_list);
 
715
  $('#cart_category_list_' + count).append(category_list);
716
  $('#cart_coupon_list_' + count).append(coupon_list);
717
  $('#cart_roles_list_' + count).append(roles_list);
718
  $('#cart_countries_list_' + count).append(country_list);
719
  $('#order_status_list_' + count).append(order_status_list);
720
 
 
721
  // Refresh the SelectPicker.
722
- $('.product_list,.category_list,.coupon_list,.roles_list,.country_list,.order_status_list,.purchased_history_type').selectpicker('refresh');
723
 
724
  // Default Hide List.
725
  $('#user_div_' + count).css('display', 'none');
726
  $('#product_div_' + count).css('display', 'none');
 
 
727
  $('#category_div_' + count).css('display', 'none');
728
  $('#coupon_div_' + count).css('display', 'none');
729
  $('#roles_div_' + count).css('display', 'none');
@@ -957,7 +1010,7 @@ function trigger_woocommerce_tooltip(){
957
  } else {
958
  $('#based_on_purchase_history_fields').show();
959
  }
960
- if(checked == "3"){
961
  $("#purchase_history_products").show();
962
  } else {
963
  $("#purchase_history_products").hide();
@@ -965,6 +1018,16 @@ function trigger_woocommerce_tooltip(){
965
  });
966
  $('#based_on_purchase_history').trigger('change');
967
 
 
 
 
 
 
 
 
 
 
 
968
  $('#price_rule_method').on('change', function () {
969
  var rule_method = $(this).val();
970
  $('.price_discounts_con, .price_discount_condition_con').hide();
@@ -1179,6 +1242,20 @@ function trigger_woocommerce_tooltip(){
1179
  });
1180
  $('select#enable_free_shipping').trigger('change');
1181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1182
  //--------------------------------------------------------------------------------------------------------------
1183
  //-----------------------------------------------SIDE PANEL-----------------------------------------------------
1184
  //--------------------------------------------------------------------------------------------------------------
@@ -1264,7 +1341,7 @@ function trigger_woocommerce_tooltip(){
1264
 
1265
  //------------------------------------------------------------------------------------------------------------------
1266
  function processShowOnlyTags(id_prefix, id){
1267
- var availableTags = ["user_div_", "product_div_", "category_div_", "coupon_div_", "general_", "roles_div_", "countries_div_", "purchase_history_div_"];
1268
  $.each(availableTags, function( index, value ) {
1269
  if(value == id_prefix)
1270
  $('#'+value+id).css('display', 'block');
@@ -1273,6 +1350,7 @@ function trigger_woocommerce_tooltip(){
1273
  });
1274
  }
1275
  function showOnly(option, id) {
 
1276
  if (option == 'products_atleast_one' || option == 'products_not_in') {
1277
  processShowOnlyTags('product_div_', id);
1278
  } else if (option == 'categories_atleast_one' || option == 'categories_not_in' || option == 'categories_in' || option == 'in_each_category' || option == 'atleast_one_including_sub_categories') {
@@ -1285,9 +1363,14 @@ function trigger_woocommerce_tooltip(){
1285
  processShowOnlyTags('roles_div_', id);
1286
  } else if (option == 'shipping_countries_in') {
1287
  processShowOnlyTags('countries_div_', id);
1288
- } else if (option == 'customer_based_on_purchase_history' || option == 'customer_based_on_purchase_history_product_order_count' || option == 'customer_based_on_purchase_history_order_count') {
 
 
 
 
 
1289
  processShowOnlyTags('purchase_history_div_', id);
1290
- if(option == 'customer_based_on_purchase_history_product_order_count'){
1291
  $('#purchase_history_div_'+id+' #purchase_history_products_list_'+id).show();
1292
  } else {
1293
  $('#purchase_history_div_'+id+' #purchase_history_products_list_'+id).hide();
593
  $(document).on('click', '#add_cart_rule', function () {
594
  var count = $('.cart_rules_list').length;
595
  var product_list = '';
596
+ var products_list = '';
597
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
598
  $.ajax({
599
  url: ajax_url,
611
  $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
612
  }
613
  });
614
+ $.ajax({
615
+ url: ajax_url,
616
+ type: 'POST',
617
+ data: {action: 'loadProductSelectBox', name: 'discount_rule['+count+'][products]'},
618
+ beforeSend: function() {
619
+ loader.show();
620
+ },
621
+ complete: function() {
622
+ loader.hide();
623
+ },
624
+ success: function (response) {
625
+ products_list = response;
626
+ $('#products_list_'+count).html(products_list);
627
+ $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
628
+ }
629
+ });
630
 
631
  // Cloning the List.
632
  var user_list = $('#cart_user_list_0 > option').clone();
639
  var form = '<div class="cart_rules_list row"> <div class="col-md-3 form-group"> <label>'+woo_discount_localization.type_text+' <select class="form-control cart_rule_type" id="cart_condition_type_' + count + '" name="discount_rule[' + count + '][type]"> <optgroup label="'+woo_discount_localization.cart_subtotal+'"><option value="subtotal_least" selected="selected">'+woo_discount_localization.subtotal_at_least+'</option><option value="subtotal_less">'+woo_discount_localization.subtotal_less_than+'</option></optgroup>' +
640
  '<optgroup label="'+woo_discount_localization.cart_item_count+'"><option value="item_count_least">'+woo_discount_localization.number_of_line_items_in_cart_at_least+'</option><option value="item_count_less">'+woo_discount_localization.number_of_line_items_in_cart_less_than+'</option></optgroup>' +
641
  '<optgroup label="'+woo_discount_localization.quantity_sum+'"><option value="quantity_least">'+woo_discount_localization.total_number_of_quantities_in_cart_at_least+'</option><option value="quantity_less">'+woo_discount_localization.total_number_of_quantities_in_cart_less_than+'</option></optgroup>' +
642
+ '<optgroup label="'+woo_discount_localization.products_in_cart+'">' +
643
+ '<option value="products_in_list">'+woo_discount_localization.products_in_list+'</option>' +
644
+ '<option value="products_not_in_list">'+woo_discount_localization.products_not_in_list+'</option>' +
645
+ '<option value="exclude_sale_products">'+woo_discount_localization.exclude_sale_products+'</option>' +
646
+ '</optgroup>' +
647
  '<optgroup label="'+woo_discount_localization.categories_in_cart+'">' +
648
  '<option value="categories_in">'+woo_discount_localization.categories_in_cart+'</option>' +
649
  '<option value="atleast_one_including_sub_categories">'+woo_discount_localization.atleast_one_including_sub_categories+'</option>' +
659
  '<option value="customer_based_on_purchase_history">'+woo_discount_localization.purchased_amount+'</option>'+
660
  '<option value="customer_based_on_purchase_history_order_count">'+woo_discount_localization.number_of_order_purchased+'</option>'+
661
  '<option value="customer_based_on_purchase_history_product_order_count">'+woo_discount_localization.number_of_order_purchased_in_product+'</option>'+
662
+ '<option value="customer_based_on_purchase_history_product_quantity_count">'+woo_discount_localization.number_of_order_quantity_purchased_in_product+'</option>'+
663
  '</optgroup>' +
664
  '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option value="coupon_applied_any_one">'+woo_discount_localization.atleast_any_one+'</option><option value="coupon_applied_all_selected">'+woo_discount_localization.all_selected_coupon+'</option></optgroup>' +
665
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
666
+ '<div class="col-md-3 form-group"><label> <span class="value_text_' +count+ '">'+woo_discount_localization.value_text+'</span><div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
667
  '<div id="user_div_' + count + '">';
668
  if($('#flycart_wdr_woocommerce_version').val() == 2){
669
  form += '<input class="wc-customer-search" style="width: 250px" name="discount_rule[' + count + '][users_to_apply][]" data-placeholder="'+woo_discount_localization.place_holder_search_for_a_user+'"/>';
672
  }
673
  form += '</div>' +
674
  '<div id="product_div_' + count + '"><select id="cart_product_list_' + count + '" class="product_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][product_to_apply][]"></select></div>' +
675
+ '<div id="products_div_' + count + '"><div class="form-group" id="products_list_'+ count +'"></div></div>' +
676
+ '<div id="exclude_on_sale_products_div_' + count + '">'+woo_discount_localization.exclude_sale_products_desc+'</div>' +
677
  '<div id="category_div_' + count + '"><select id="cart_category_list_' + count + '" class="category_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][category_to_apply][]"></select></div>';
678
  if($('#has_large_number_of_coupon').val() == 1){
679
  form += '<div id="coupon_div_' + count + '"><select id="cart_coupon_list_' + count + '" class="coupons_selectbox_multi_select_wdr" multiple name="discount_rule[' + count + '][coupon_to_apply][]"></select></div>';
689
  '<option value="atleast">'+woo_discount_localization.greater_than_or_equal_to+'</option>' +
690
  '<option value="less_than_or_equal">'+woo_discount_localization.less_than_or_equal_to+'</option>' +
691
  '</select>' +
692
+ ' <input name="discount_rule[' + count + '][purchased_history_amount]" value="" type="text"/> '+woo_discount_localization.in_order_status+' <select id="order_status_list_' + count + '" class="order_status_list selectpicker" data-live-search="true" multiple name="discount_rule[' + count + '][purchase_history_order_status][]"></select>' +
693
+ ' <select class="selectpicker purchased_history_duration" data-index="'+count+'" name="discount_rule['+count+'][purchased_history_duration]">' +
694
+ '<option value="all_time">'+woo_discount_localization.from_all_previous_orders+'</option>' +
695
+ '<option value="7_days">'+woo_discount_localization.last_7_days+'</option>' +
696
+ '<option value="14_days">'+woo_discount_localization.last_14_days+'</option>' +
697
+ '<option value="30_days">'+woo_discount_localization.last_30_days+'</option>' +
698
+ '<option value="60_days">'+woo_discount_localization.last_60_days+'</option>' +
699
+ '<option value="90_days">'+woo_discount_localization.last_90_days+'</option>' +
700
+ '<option value="180_days">'+woo_discount_localization.last_180_days+'</option>' +
701
+ '<option value="1_year">'+woo_discount_localization.last_1_year+'</option>' +
702
+ '<option value="custom_days">'+woo_discount_localization.custom_days+'</option>' +
703
+ '</select>' +
704
+ '<span class="purchased_history_duration_days_con" id="purchased_history_duration_days_con_'+count+'">' +
705
+ '<input name="discount_rule['+count+'][purchased_history_duration_days]" value="" placeholder="30" type="text"/> '+woo_discount_localization.in_days+
706
+ '</span>' +
707
+ '</div>' +
708
  '</div><div class="col-md-1"> <label> '+woo_discount_localization.action_text+'</label> <br> <a href=javascript:void(0) class="btn btn-danger remove_cart_rule">'+woo_discount_localization.remove_text+'</a> </div>' +
709
  '</label></div>';
710
  } else {
711
  var form = '<div class="cart_rules_list row"> <div class="col-md-3 form-group"> <label>'+woo_discount_localization.type_text+' <select class="form-control cart_rule_type" id="cart_condition_type_' + count + '" name="discount_rule[' + count + '][type]"> <optgroup label="'+woo_discount_localization.cart_subtotal+'"><option value="subtotal_least" selected="selected">'+woo_discount_localization.subtotal_at_least+'</option><option value="subtotal_less">'+woo_discount_localization.subtotal_less_than+'</option></optgroup>' +
712
  '<optgroup label="'+woo_discount_localization.cart_item_count+'"><option value="item_count_least">'+woo_discount_localization.number_of_line_items_in_cart_at_least+'</option><option value="item_count_less">'+woo_discount_localization.number_of_line_items_in_cart_less_than+'</option></optgroup>' +
713
  '<optgroup label="'+woo_discount_localization.quantity_sum+'"><option disabled>'+woo_discount_localization.total_number_of_quantities_in_cart_at_least+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.total_number_of_quantities_in_cart_less_than+' <b>' + pro_suffix + '</b></option></optgroup>' +
714
+ '<optgroup label="'+woo_discount_localization.products_in_cart+'">' +
715
+ '<option disabled>'+woo_discount_localization.products_in_list+' <b>' + pro_suffix + '</b></option>' +
716
+ '<option disabled>'+woo_discount_localization.products_not_in_list+' <b>' + pro_suffix + '</b></option>' +
717
+ '<option disabled>'+woo_discount_localization.exclude_sale_products+' <b>' + pro_suffix + '</b></option>' +
718
+ '</optgroup>' +
719
  '<optgroup label="'+woo_discount_localization.categories_in_cart+'">' +
720
  '<option disabled>'+woo_discount_localization.categories_in_cart+' <b>' + pro_suffix + '</b></option>' +
721
  '<option disabled>'+woo_discount_localization.atleast_one_including_sub_categories+' <b>' + pro_suffix + '</b></option>' +
733
  '</optgroup>' +
734
  '<optgroup label="'+woo_discount_localization.coupon_applied+'"><option disabled>'+woo_discount_localization.atleast_any_one+' <b>' + pro_suffix + '</b></option><option disabled>'+woo_discount_localization.all_selected+' <b>' + pro_suffix + '</b></option></optgroup>' +
735
  '</select></label><div class="wdr_cart_rule_doc_con"></div></div>' +
736
+ '<div class="col-md-3 form-group"><label> <span class="value_text_'+count+'">'+woo_discount_localization.value_text+'</span><div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
737
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
738
  '<div id="product_div_' + count + '"><select id="cart_product_list_' + count + '" class="product_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][product_to_apply][]"></select></div>' +
739
  '<div id="category_div_' + count + '"><select id="cart_category_list_' + count + '" class="category_list selectpicker" title="'+woo_discount_localization.none_selected+'" data-live-search="true" multiple name="discount_rule[' + count + '][category_to_apply][]"></select></div>' +
750
  $('#purchase_history_products_list_'+count).html(product_list);
751
  $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
752
  }
753
+ if(products_list != ''){
754
+ $('#products_list_'+count).html(products_list);
755
+ $('.wc-product-search').trigger( 'wc-enhanced-select-init' );
756
+ }
757
 
758
  $('.wc-customer-search').trigger( 'wc-enhanced-select-init' );
759
  $('.coupons_selectbox_multi_select_wdr').trigger('trigger_ajax_select_wdr');
761
  // Append the List of Values.
762
  $('#cart_user_list_' + count).append(user_list);
763
  $('#cart_product_list_' + count).append(product_list);
764
+ $('#products_list_' + count).append(products_list);
765
  $('#cart_category_list_' + count).append(category_list);
766
  $('#cart_coupon_list_' + count).append(coupon_list);
767
  $('#cart_roles_list_' + count).append(roles_list);
768
  $('#cart_countries_list_' + count).append(country_list);
769
  $('#order_status_list_' + count).append(order_status_list);
770
 
771
+ $('select.purchased_history_duration').trigger('change');
772
  // Refresh the SelectPicker.
773
+ $('.product_list,.category_list,.coupon_list,.roles_list,.country_list,.order_status_list,.purchased_history_type,.purchased_history_duration').selectpicker('refresh');
774
 
775
  // Default Hide List.
776
  $('#user_div_' + count).css('display', 'none');
777
  $('#product_div_' + count).css('display', 'none');
778
+ $('#products_div_' + count).css('display', 'none');
779
+ $('#exclude_on_sale_products_div_' + count).css('display', 'none');
780
  $('#category_div_' + count).css('display', 'none');
781
  $('#coupon_div_' + count).css('display', 'none');
782
  $('#roles_div_' + count).css('display', 'none');
1010
  } else {
1011
  $('#based_on_purchase_history_fields').show();
1012
  }
1013
+ if(checked == "3" || checked == "4"){
1014
  $("#purchase_history_products").show();
1015
  } else {
1016
  $("#purchase_history_products").hide();
1018
  });
1019
  $('#based_on_purchase_history').trigger('change');
1020
 
1021
+ $('#purchased_history_duration').on('change', function () {
1022
+ var duration_value = $( this ).val();
1023
+ if(duration_value == "custom_days"){
1024
+ $('#purchased_history_duration_days_con').show();
1025
+ } else {
1026
+ $('#purchased_history_duration_days_con').hide();
1027
+ }
1028
+ });
1029
+ $('#purchased_history_duration').trigger('change');
1030
+
1031
  $('#price_rule_method').on('change', function () {
1032
  var rule_method = $(this).val();
1033
  $('.price_discounts_con, .price_discount_condition_con').hide();
1242
  });
1243
  $('select#enable_free_shipping').trigger('change');
1244
 
1245
+ $(document).on('change', 'select.purchased_history_duration', function () {
1246
+ //$('select.purchased_history_duration').on('change', function () {
1247
+ var option_val = $(this).val();
1248
+ var option_index = $(this).attr('data-index');
1249
+ if(option_index != undefined && option_index != null && option_index != ''){
1250
+ if (option_val == 'custom_days') {
1251
+ $('#purchased_history_duration_days_con_'+option_index).show();
1252
+ } else {
1253
+ $('#purchased_history_duration_days_con_'+option_index).hide();
1254
+ }
1255
+ }
1256
+ });
1257
+ $('select.purchased_history_duration').trigger('change');
1258
+
1259
  //--------------------------------------------------------------------------------------------------------------
1260
  //-----------------------------------------------SIDE PANEL-----------------------------------------------------
1261
  //--------------------------------------------------------------------------------------------------------------
1341
 
1342
  //------------------------------------------------------------------------------------------------------------------
1343
  function processShowOnlyTags(id_prefix, id){
1344
+ var availableTags = ["user_div_", "product_div_", "category_div_", "coupon_div_", "general_", "roles_div_", "countries_div_", "purchase_history_div_", "products_div_", "exclude_on_sale_products_div_"];
1345
  $.each(availableTags, function( index, value ) {
1346
  if(value == id_prefix)
1347
  $('#'+value+id).css('display', 'block');
1350
  });
1351
  }
1352
  function showOnly(option, id) {
1353
+ $('.value_text_'+id).css('display', 'block');
1354
  if (option == 'products_atleast_one' || option == 'products_not_in') {
1355
  processShowOnlyTags('product_div_', id);
1356
  } else if (option == 'categories_atleast_one' || option == 'categories_not_in' || option == 'categories_in' || option == 'in_each_category' || option == 'atleast_one_including_sub_categories') {
1363
  processShowOnlyTags('roles_div_', id);
1364
  } else if (option == 'shipping_countries_in') {
1365
  processShowOnlyTags('countries_div_', id);
1366
+ } else if (option == 'products_in_list' || option == 'products_not_in_list') {
1367
+ processShowOnlyTags('products_div_', id);
1368
+ } else if (option == 'exclude_sale_products') {
1369
+ $('.value_text_'+id).css('display', 'none');
1370
+ processShowOnlyTags('exclude_on_sale_products_div_', id);
1371
+ } else if (option == 'customer_based_on_purchase_history' || option == 'customer_based_on_purchase_history_product_order_count' || option == 'customer_based_on_purchase_history_order_count' || option == 'customer_based_on_purchase_history_product_quantity_count') {
1372
  processShowOnlyTags('purchase_history_div_', id);
1373
+ if(option == 'customer_based_on_purchase_history_product_order_count' || option == 'customer_based_on_purchase_history_product_quantity_count'){
1374
  $('#purchase_history_div_'+id+' #purchase_history_products_list_'+id).show();
1375
  } else {
1376
  $('#purchase_history_div_'+id+' #purchase_history_products_list_'+id).hide();
assets/js/woo_discount_rules.js CHANGED
@@ -50,9 +50,17 @@ jQuery( document ).ready( function() {
50
  if(response.status == 1){
51
  if(target !== null){
52
  target.html(response.price_html);
 
 
 
 
 
 
 
 
53
  }
54
  }
55
- current_object.trigger("woo_discount_rules_after_display_strikeout_price_on_quantity_update");
56
  }
57
  });
58
  }
50
  if(response.status == 1){
51
  if(target !== null){
52
  target.html(response.price_html);
53
+ if(response.product_type == 'variation'){
54
+ if(response.has_single_price != undefined && response.parent_id != undefined){
55
+ if(response.has_single_price == 1){
56
+ var variation_price_target = jQuery('#product-'+response.parent_id+' .summary > p.price');
57
+ variation_price_target.html(response.price_html);
58
+ }
59
+ }
60
+ }
61
  }
62
  }
63
+ current_object.trigger("woo_discount_rules_after_display_strikeout_price_on_quantity_update", [ product_id, response ]);
64
  }
65
  });
66
  }
helper/general-helper.php CHANGED
@@ -359,7 +359,9 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
359
  $result = array();
360
  foreach ($rules as $index => $item) {
361
  foreach ($item as $id => $value) {
362
- $result[$id] = $value;
 
 
363
  }
364
  }
365
  $rules = $result;
@@ -795,7 +797,8 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
795
  $coupon_amount = $wc->cart->get_coupon_discount_amount($coupon);
796
  if($coupon_amount == 0){
797
  $has_coupon = true;
798
- $style = '.coupon-'.strtolower($coupon).' .amount{display: none}.coupon-'.strtolower($coupon).' td::first-letter{font-size: 0}';
 
799
  $styles .= apply_filters('woo_discount_rules_apply_style_for_zero_price_coupon', $style, $coupon);
800
  }
801
  }
359
  $result = array();
360
  foreach ($rules as $index => $item) {
361
  foreach ($item as $id => $value) {
362
+ if(!in_array($id, array('product_variants'))){
363
+ $result[$id] = $value;
364
+ }
365
  }
366
  }
367
  $rules = $result;
797
  $coupon_amount = $wc->cart->get_coupon_discount_amount($coupon);
798
  if($coupon_amount == 0){
799
  $has_coupon = true;
800
+ $coupon_code_class = esc_attr( sanitize_title( strtolower($coupon) ) );
801
+ $style = '.coupon-'.$coupon_code_class.' .amount{display: none}.coupon-'.$coupon_code_class.' td::first-letter{font-size: 0}';
802
  $styles .= apply_filters('woo_discount_rules_apply_style_for_zero_price_coupon', $style, $coupon);
803
  }
804
  }
helper/purchase.php CHANGED
@@ -143,6 +143,12 @@ if ( ! class_exists( 'FlycartWooDiscountRulesPurchase' ) ) {
143
  echo '<td colspan="2"> <div class="notice-message error inline notice-error notice-alt"><p>'.$message.'</p></div></td>';
144
  echo '</tr>';
145
  }
 
 
 
 
 
 
146
  }
147
 
148
  }
143
  echo '<td colspan="2"> <div class="notice-message error inline notice-error notice-alt"><p>'.$message.'</p></div></td>';
144
  echo '</tr>';
145
  }
146
+
147
+ if(empty($plugin_data['package']) && !empty($plugin_data['upgrade_notice'])){
148
+ echo '<tr class="plugin-update-tr active" data-slug="woo-discount-rules">';
149
+ echo '<td class="plugin-update colspanchange" colspan="3"> <div class="notice inline notice-warning notice-alt"><p>'.$plugin_data['upgrade_notice'].'</p></div></td>';
150
+ echo '</tr>';
151
+ }
152
  }
153
 
154
  }
helper/woo-function.php CHANGED
@@ -251,6 +251,35 @@ if(!class_exists('FlycartWoocommerceProduct')){
251
  }
252
  }
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  /**
255
  * Get product price including tax
256
  *
@@ -752,6 +781,38 @@ if(!class_exists('FlycartWoocommerceOrder')){
752
 
753
  return $productIds;
754
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  }
756
  }
757
 
251
  }
252
  }
253
 
254
+ /**
255
+ * Is product is on sale
256
+ *
257
+ * @access public
258
+ * @param array $product
259
+ * @return boolean
260
+ */
261
+ public static function is_product_is_on_sale($product)
262
+ {
263
+ $sale_price = self::get_sale_price($product);
264
+ if($sale_price > 0){
265
+ $on_sale = true;
266
+ if(method_exists($product, 'get_date_on_sale_from')){
267
+ if ( $product->get_date_on_sale_from() && $product->get_date_on_sale_from()->getTimestamp() > current_time( 'timestamp', true ) ) {
268
+ $on_sale = false;
269
+ }
270
+ }
271
+ if(method_exists($product, 'get_date_on_sale_to')){
272
+ if ( $product->get_date_on_sale_to() && $product->get_date_on_sale_to()->getTimestamp() < current_time( 'timestamp', true ) ) {
273
+ $on_sale = false;
274
+ }
275
+ }
276
+
277
+ return $on_sale;
278
+ }
279
+
280
+ return false;
281
+ }
282
+
283
  /**
284
  * Get product price including tax
285
  *
781
 
782
  return $productIds;
783
  }
784
+
785
+ /**
786
+ * Get order product quantities
787
+ *
788
+ * @access public
789
+ * @param object $order
790
+ * @return array
791
+ */
792
+ public static function get_product_quantities($order)
793
+ {
794
+ $items = $order->get_items();
795
+ $productIds = array();
796
+ if(!empty($items)){
797
+ foreach ($items as $item){
798
+ $product_id = FlycartWoocommerceVersion::wcVersion('3.0') ? $item->get_product_id() : $item['product_id'];
799
+ $variant_id = FlycartWoocommerceVersion::wcVersion('3.0') ? $item->get_variation_id() : $item['variation_id'];
800
+ $quantity = FlycartWoocommerceVersion::wcVersion('3.0') ? $item->get_quantity() : $item['quantity'];
801
+ if($variant_id){
802
+ $productId = $variant_id;
803
+ } else {
804
+ $productId = $product_id;
805
+ }
806
+ if(isset($productIds[$productId])){
807
+ $productIds[$productId] = $productIds[$productId]+$quantity;
808
+ } else {
809
+ $productIds[$productId] = $quantity;
810
+ }
811
+ }
812
+ }
813
+
814
+ return $productIds;
815
+ }
816
  }
817
  }
818
 
i18n/languages/woo-discount-rules.pot CHANGED
@@ -15,31 +15,31 @@ msgstr ""
15
  msgid "Guest"
16
  msgstr ""
17
 
18
- #: helper/general-helper.php:586
19
  msgid "Start date and time is set in the future date"
20
  msgstr ""
21
 
22
- #: helper/general-helper.php:589
23
  msgid "Validity expired"
24
  msgstr ""
25
 
26
- #: helper/general-helper.php:606
27
  msgid "Will run in future"
28
  msgstr ""
29
 
30
- #: helper/general-helper.php:609
31
  msgid "Not running - validity expired"
32
  msgstr ""
33
 
34
- #: helper/general-helper.php:626
35
  msgid "Running"
36
  msgstr ""
37
 
38
- #: helper/general-helper.php:631
39
  msgid "Your server current date and time: "
40
  msgstr ""
41
 
42
- #: helper/general-helper.php:753
43
  msgid "Read Docs"
44
  msgstr ""
45
 
@@ -57,7 +57,7 @@ msgid "seems invalid."
57
  msgstr ""
58
 
59
  #: helper/purchase.php:60 helper/purchase.php:64 helper/purchase.php:132
60
- #: helper/purchase.php:135 helper/purchase.php:165
61
  msgid "Please enter a valid license key"
62
  msgstr ""
63
 
@@ -95,19 +95,19 @@ msgstr ""
95
  msgid "Core"
96
  msgstr ""
97
 
98
- #: helper/purchase.php:174
99
  msgid "License key check : Passed."
100
  msgstr ""
101
 
102
- #: helper/purchase.php:178 view/settings_general.php:31
103
  msgid "License key seems to be Invalid. Please enter a valid license key"
104
  msgstr ""
105
 
106
- #: helper/woo-function.php:442 helper/woo-function.php:452
107
  msgid "Search for a product&hellip;"
108
  msgstr ""
109
 
110
- #: helper/woo-function.php:485 helper/woo-function.php:497
111
  msgid "Search for a user&hellip;"
112
  msgstr ""
113
 
@@ -125,7 +125,7 @@ msgid "Free Shipping"
125
  msgstr ""
126
 
127
  #: includes/advanced/free_shipping_method.php:73
128
- #: includes/discount-base.php:1043 view/cart-rules.php:133
129
  #: view/pricing-rules.php:163 view/settings_promotion.php:65
130
  #: view/settings_promotion.php:100
131
  msgid "Enable"
@@ -143,12 +143,12 @@ msgstr ""
143
  msgid "Title to be display on site"
144
  msgstr ""
145
 
146
- #: includes/discount-base.php:194 view/cart-rules.php:147
147
  #: view/pricing-rules.php:177
148
  msgid "Active"
149
  msgstr ""
150
 
151
- #: includes/discount-base.php:196 view/cart-rules.php:149
152
  #: view/pricing-rules.php:179 view/settings_cart_rules.php:95
153
  #: view/settings_cart_rules.php:102 view/settings_price_rules.php:169
154
  #: view/settings_promotion.php:22 view/settings_promotion.php:62
@@ -156,479 +156,484 @@ msgstr ""
156
  msgid "Disabled"
157
  msgstr ""
158
 
159
- #: includes/discount-base.php:503
160
  msgid "Cache cleared successfully"
161
  msgstr ""
162
 
163
- #: includes/discount-base.php:505
164
  msgid "Failed to clear cache"
165
  msgstr ""
166
 
167
- #: includes/discount-base.php:616 includes/discount-base.php:651
168
  msgid "Failed to do action"
169
  msgstr ""
170
 
171
- #: includes/discount-base.php:655
172
  msgid "Disabled successfully"
173
  msgstr ""
174
 
175
- #: includes/discount-base.php:658
176
  msgid "Deleted successfully"
177
  msgstr ""
178
 
179
- #: includes/discount-base.php:661
180
  msgid "Enabled successfully"
181
  msgstr ""
182
 
183
- #: includes/discount-base.php:681 includes/discount-base.php:682
184
- #: includes/discount-base.php:699
185
  msgid "copy"
186
  msgstr ""
187
 
188
- #: includes/discount-base.php:707
189
  msgid "Duplicate rule created successfully"
190
  msgstr ""
191
 
192
- #: includes/discount-base.php:711
193
  msgid "Failed to create duplicate rule"
194
  msgstr ""
195
 
196
- #: includes/discount-base.php:998
197
  msgid "Please fill this field"
198
  msgstr ""
199
 
200
- #: includes/discount-base.php:999
201
  msgid "Please Enter the Rule Name to Create / Save."
202
  msgstr ""
203
 
204
- #: includes/discount-base.php:1000
205
  msgid "Saving..."
206
  msgstr ""
207
 
208
- #: includes/discount-base.php:1001 view/view-cart-rules.php:54
209
  #: view/view-pricing-rules.php:37
210
  msgid "Save Rule"
211
  msgstr ""
212
 
213
- #: includes/discount-base.php:1002
214
  msgid "Please enter a Key"
215
  msgstr ""
216
 
217
- #: includes/discount-base.php:1003 view/view-pricing-rules.php:657
218
  msgid "Min Quantity"
219
  msgstr ""
220
 
221
- #: includes/discount-base.php:1004 view/view-pricing-rules.php:664
222
  msgid "Max Quantity"
223
  msgstr ""
224
 
225
- #: includes/discount-base.php:1005 view/view-cart-rules.php:91
226
- #: view/view-pricing-rules.php:74 view/view-pricing-rules.php:662
227
- #: view/view-pricing-rules.php:735 view/view-pricing-rules.php:752
228
- #: view/view-pricing-rules.php:759
229
  msgid "ex. 1"
230
  msgstr ""
231
 
232
- #: includes/discount-base.php:1006 view/view-pricing-rules.php:797
233
  msgid "ex. 10"
234
  msgstr ""
235
 
236
- #: includes/discount-base.php:1007 view/view-pricing-rules.php:669
237
- #: view/view-pricing-rules.php:711
238
  msgid "ex. 50"
239
  msgstr ""
240
 
241
- #: includes/discount-base.php:1008
242
  msgid "Search for a user"
243
  msgstr ""
244
 
245
- #: includes/discount-base.php:1009 view/view-pricing-rules.php:670
246
  msgid "Adjustment Type"
247
  msgstr ""
248
 
249
- #: includes/discount-base.php:1010 view/view-pricing-rules.php:786
250
  msgid "Discount percentage"
251
  msgstr ""
252
 
253
- #: includes/discount-base.php:1011 view/view-cart-rules.php:612
254
- #: view/view-pricing-rules.php:676
255
  msgid "Percentage Discount"
256
  msgstr ""
257
 
258
- #: includes/discount-base.php:1012 view/view-cart-rules.php:618
259
- #: view/view-cart-rules.php:620 view/view-pricing-rules.php:684
260
- #: view/view-pricing-rules.php:686
261
  msgid "Price Discount"
262
  msgstr ""
263
 
264
- #: includes/discount-base.php:1013 view/view-pricing-rules.php:694
265
- #: view/view-pricing-rules.php:696
266
  msgid "BOGO Product Discount"
267
  msgstr ""
268
 
269
- #: includes/discount-base.php:1014
270
  msgid "Product Discount - Not support for subtotal based rule"
271
  msgstr ""
272
 
273
- #: includes/discount-base.php:1015 view/view-cart-rules.php:398
274
- #: view/view-pricing-rules.php:706 view/view-pricing-rules.php:826
275
  msgid "Value"
276
  msgstr ""
277
 
278
- #: includes/discount-base.php:1016 view/view-pricing-rules.php:718
279
  msgid "receive discount for"
280
  msgstr ""
281
 
282
- #: includes/discount-base.php:1017 view/view-pricing-rules.php:720
283
  msgid "Auto add all selected products"
284
  msgstr ""
285
 
286
- #: includes/discount-base.php:1018 view/view-pricing-rules.php:721
287
  msgid "Same product"
288
  msgstr ""
289
 
290
- #: includes/discount-base.php:1019 view/view-pricing-rules.php:722
291
  msgid "Any one cheapest from selected"
292
  msgstr ""
293
 
294
- #: includes/discount-base.php:1020 view/view-pricing-rules.php:723
295
  msgid "Any one cheapest from all products"
296
  msgstr ""
297
 
298
- #: includes/discount-base.php:1021 view/view-pricing-rules.php:724
299
  msgid "Cheapest in cart - selected category(ies)"
300
  msgstr ""
301
 
302
- #: includes/discount-base.php:1022 view/view-pricing-rules.php:725
303
  msgid "Cheapest in cart - selected item(s)"
304
  msgstr ""
305
 
306
- #: includes/discount-base.php:1023 view/view-pricing-rules.php:726
307
  msgid "Cheapest among all items in cart"
308
  msgstr ""
309
 
310
- #: includes/discount-base.php:1024 view/view-pricing-rules.php:730
311
  msgid "Free quantity"
312
  msgstr ""
313
 
314
- #: includes/discount-base.php:1025 view/view-pricing-rules.php:730
315
  msgid "Number of quantity(ies) in each selected product(s)"
316
  msgstr ""
317
 
318
- #: includes/discount-base.php:1026 view/view-pricing-rules.php:744
319
  msgid "Fixed item count (not recommended)"
320
  msgstr ""
321
 
322
- #: includes/discount-base.php:1027 view/view-pricing-rules.php:743
323
  msgid "Dynamic item count"
324
  msgstr ""
325
 
326
- #: includes/discount-base.php:1028 view/view-pricing-rules.php:746
327
  msgid ""
328
  "Fixed item count - You need to provide item count manually. Dynamic item "
329
  "count - System will choose dynamically based on cart"
330
  msgstr ""
331
 
332
- #: includes/discount-base.php:1029 view/view-pricing-rules.php:747
333
  msgid "Item count"
334
  msgstr ""
335
 
336
- #: includes/discount-base.php:1030 view/view-pricing-rules.php:747
337
  msgid "Discount for number of item(s) in cart"
338
  msgstr ""
339
 
340
- #: includes/discount-base.php:1031 view/view-pricing-rules.php:754
341
  msgid "Discount for number of quantity(ies) in each item"
342
  msgstr ""
343
 
344
- #: includes/discount-base.php:1032 view/view-pricing-rules.php:754
345
  msgid "Item quantity"
346
  msgstr ""
347
 
348
- #: includes/discount-base.php:1033
349
  msgid "Search for a products"
350
  msgstr ""
351
 
352
- #: includes/discount-base.php:1034
353
  msgid "and"
354
  msgstr ""
355
 
356
- #: includes/discount-base.php:1035 view/view-pricing-rules.php:788
357
  msgid "100% percent"
358
  msgstr ""
359
 
360
- #: includes/discount-base.php:1036 view/view-pricing-rules.php:789
361
  msgid "Limited percent"
362
  msgstr ""
363
 
364
- #: includes/discount-base.php:1037
365
  msgid "Percentage"
366
  msgstr ""
367
 
368
- #: includes/discount-base.php:1038
369
  msgid "as discount"
370
  msgstr ""
371
 
372
- #: includes/discount-base.php:1039 view/view-cart-rules.php:575
373
- #: view/view-pricing-rules.php:803
374
  msgid "Remove"
375
  msgstr ""
376
 
377
- #: includes/discount-base.php:1040 view/cart-rules.php:170
378
- #: view/pricing-rules.php:200 view/view-pricing-rules.php:806
379
  msgid "Duplicate"
380
  msgstr ""
381
 
382
- #: includes/discount-base.php:1041
383
  msgid "none"
384
  msgstr ""
385
 
386
- #: includes/discount-base.php:1042
387
  msgid "Are you sure to remove this ?"
388
  msgstr ""
389
 
390
- #: includes/discount-base.php:1044 view/cart-rules.php:130
391
  #: view/pricing-rules.php:160
392
  msgid "Disable"
393
  msgstr ""
394
 
395
- #: includes/discount-base.php:1045
396
  msgid "Are you sure to remove ?"
397
  msgstr ""
398
 
399
- #: includes/discount-base.php:1046 view/view-cart-rules.php:171
400
  msgid "Type"
401
  msgstr ""
402
 
403
- #: includes/discount-base.php:1047 view/view-cart-rules.php:175
404
  msgid "Cart Subtotal"
405
  msgstr ""
406
 
407
- #: includes/discount-base.php:1048 view/view-cart-rules.php:178
408
  msgid "Subtotal at least"
409
  msgstr ""
410
 
411
- #: includes/discount-base.php:1049 view/view-cart-rules.php:182
412
  msgid "Subtotal less than"
413
  msgstr ""
414
 
415
- #: includes/discount-base.php:1050 view/view-cart-rules.php:185
416
  msgid "Cart Item Count"
417
  msgstr ""
418
 
419
- #: includes/discount-base.php:1051 view/view-cart-rules.php:188
420
  msgid "Number of line items in the cart (not quantity) at least"
421
  msgstr ""
422
 
423
- #: includes/discount-base.php:1052 view/view-cart-rules.php:192
424
  msgid "Number of line items in the cart (not quantity) less than"
425
  msgstr ""
426
 
427
- #: includes/discount-base.php:1053 view/view-cart-rules.php:195
428
  msgid "Quantity Sum"
429
  msgstr ""
430
 
431
- #: includes/discount-base.php:1054 view/view-cart-rules.php:201
432
- #: view/view-cart-rules.php:204
433
  msgid "Total number of quantities in the cart at least"
434
  msgstr ""
435
 
436
- #: includes/discount-base.php:1055 view/view-cart-rules.php:213
437
- #: view/view-cart-rules.php:216
438
  msgid "Total number of quantities in the cart less than"
439
  msgstr ""
440
 
441
- #: includes/discount-base.php:1056 view/view-cart-rules.php:225
442
  msgid "Categories in cart"
443
  msgstr ""
444
 
445
- #: includes/discount-base.php:1057 view/view-cart-rules.php:231
446
  msgid "Including sub-categories in cart"
447
  msgstr ""
448
 
449
- #: includes/discount-base.php:1058 view/view-cart-rules.php:240
450
  msgid "Customer Details (must be logged in)"
451
  msgstr ""
452
 
453
- #: includes/discount-base.php:1059 view/view-cart-rules.php:246
454
- #: view/view-cart-rules.php:248
455
  msgid "User in list"
456
  msgstr ""
457
 
458
- #: includes/discount-base.php:1060 view/view-cart-rules.php:256
459
- #: view/view-cart-rules.php:258
460
  msgid "User role in list"
461
  msgstr ""
462
 
463
- #: includes/discount-base.php:1061 view/view-cart-rules.php:266
464
- #: view/view-cart-rules.php:268
465
  msgid "Shipping country in list"
466
  msgstr ""
467
 
468
- #: includes/discount-base.php:1062 view/view-cart-rules.php:272
469
  msgid "Customer Email"
470
  msgstr ""
471
 
472
- #: includes/discount-base.php:1063
473
  msgid "Email with TLD (Ege: edu)"
474
  msgstr ""
475
 
476
- #: includes/discount-base.php:1064 view/view-cart-rules.php:288
477
- #: view/view-cart-rules.php:290
478
  msgid "Email with Domain (Eg: gmail.com)"
479
  msgstr ""
480
 
481
- #: includes/discount-base.php:1065 view/view-cart-rules.php:294
482
  msgid "Customer Billing Details"
483
  msgstr ""
484
 
485
- #: includes/discount-base.php:1066 view/view-cart-rules.php:300
486
- #: view/view-cart-rules.php:302
487
  msgid "Billing city"
488
  msgstr ""
489
 
490
- #: includes/discount-base.php:1067 view/view-cart-rules.php:306
491
  msgid "Customer Shipping Details"
492
  msgstr ""
493
 
494
- #: includes/discount-base.php:1068 view/view-cart-rules.php:312
495
- #: view/view-cart-rules.php:314
496
  msgid "Shipping state"
497
  msgstr ""
498
 
499
- #: includes/discount-base.php:1069 view/view-cart-rules.php:322
500
- #: view/view-cart-rules.php:324
501
  msgid "Shipping city"
502
  msgstr ""
503
 
504
- #: includes/discount-base.php:1070 view/view-cart-rules.php:332
505
- #: view/view-cart-rules.php:334
506
  msgid "Shipping zip code"
507
  msgstr ""
508
 
509
- #: includes/discount-base.php:1071 view/view-cart-rules.php:338
510
  #: view/view-pricing-rules.php:486
511
  msgid "Purchase History"
512
  msgstr ""
513
 
514
- #: includes/discount-base.php:1072 view/view-cart-rules.php:344
515
- #: view/view-cart-rules.php:346 view/view-pricing-rules.php:494
516
  msgid "Purchased amount"
517
  msgstr ""
518
 
519
- #: includes/discount-base.php:1073 view/view-cart-rules.php:354
520
- #: view/view-cart-rules.php:356 view/view-pricing-rules.php:495
521
  msgid "Number of previous orders made"
522
  msgstr ""
523
 
524
- #: includes/discount-base.php:1074 view/view-cart-rules.php:364
525
- #: view/view-cart-rules.php:366 view/view-pricing-rules.php:496
526
  msgid "Number of previous orders made with following products"
527
  msgstr ""
528
 
529
- #: includes/discount-base.php:1075 view/view-cart-rules.php:370
 
 
 
 
 
530
  msgid "Coupon applied"
531
  msgstr ""
532
 
533
- #: includes/discount-base.php:1076 view/view-cart-rules.php:376
534
- #: view/view-cart-rules.php:378
535
  msgid "Atleast any one"
536
  msgstr ""
537
 
538
- #: includes/discount-base.php:1077 view/view-cart-rules.php:386
539
- #: view/view-cart-rules.php:388
540
  msgid "All selected"
541
  msgstr ""
542
 
543
- #: includes/discount-base.php:1078 view/view-cart-rules.php:544
544
- #: view/view-pricing-rules.php:531
545
  msgid "Greater than or equal to"
546
  msgstr ""
547
 
548
- #: includes/discount-base.php:1079 view/view-cart-rules.php:545
549
- #: view/view-pricing-rules.php:532 view/view-pricing-rules.php:576
550
  msgid "Less than or equal to"
551
  msgstr ""
552
 
553
- #: includes/discount-base.php:1080 view/view-cart-rules.php:547
554
- #: view/view-pricing-rules.php:535
555
  msgid "and the order status should be"
556
  msgstr ""
557
 
558
- #: includes/discount-base.php:1081 view/cart-rules.php:114
559
  #: view/cart-rules.php:209 view/pricing-rules.php:144
560
- #: view/pricing-rules.php:239 view/view-cart-rules.php:574
561
  msgid "Action"
562
  msgstr ""
563
 
564
- #: includes/discount-base.php:1082 view/settings.php:21
565
  #: view/settings_taxonomy.php:21
566
  msgid "Save"
567
  msgstr ""
568
 
569
- #: includes/discount-base.php:1083
570
  msgid "Saved Successfully!"
571
  msgstr ""
572
 
573
- #: includes/discount-base.php:1084 view/view-cart-rules.php:427
574
- #: view/view-cart-rules.php:462 view/view-cart-rules.php:482
575
- #: view/view-cart-rules.php:503 view/view-cart-rules.php:552
576
  #: view/view-pricing-rules.php:235 view/view-pricing-rules.php:251
577
- #: view/view-pricing-rules.php:543 view/view-pricing-rules.php:612
578
- #: view/view-pricing-rules.php:774
579
  msgid "None selected"
580
  msgstr ""
581
 
582
- #: includes/discount-base.php:1085 view/view-cart-rules.php:237
583
  msgid "In each category"
584
  msgstr ""
585
 
586
- #: includes/discount-base.php:1086 view/settings_price_rules.php:208
587
  #: view/settings_price_rules.php:226 view/settings_price_rules.php:244
588
  #: view/settings_price_rules.php:262
589
  msgid "Show"
590
  msgstr ""
591
 
592
- #: includes/discount-base.php:1087 view/template/sidebar.php:12
593
  msgid "Hide"
594
  msgstr ""
595
 
596
- #: includes/discount-base.php:1088
597
  msgid "Please select at least one rule"
598
  msgstr ""
599
 
600
- #: includes/discount-base.php:1089
601
  msgid "Please select an action to apply"
602
  msgstr ""
603
 
604
- #: includes/discount-base.php:1090
605
  msgid "Are you sure to remove the selected rules"
606
  msgstr ""
607
 
608
- #: includes/discount-base.php:1091 view/view-pricing-rules.php:763
609
  msgid "Choose product(s)"
610
  msgstr ""
611
 
612
- #: includes/discount-base.php:1092 view/view-pricing-rules.php:773
613
  msgid "Choose category(ies)"
614
  msgstr ""
615
 
616
- #: includes/discount-base.php:1093
617
  msgid "Search for a coupon"
618
  msgstr ""
619
 
620
- #: includes/discount-base.php:1094 view/view-pricing-rules.php:702
621
- #: view/view-pricing-rules.php:797
622
  #, php-format
623
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
624
  msgstr ""
625
 
626
- #: includes/discount-base.php:1095 view/view-pricing-rules.php:703
627
  #, php-format
628
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
629
  msgstr ""
630
 
631
- #: includes/discount-base.php:1096 view/view-pricing-rules.php:728
632
  msgid ""
633
  "Auto add all selected products - Automatically added to the cart <br> Same "
634
  "product - get discount in same product <br> Any one cheapest from selected - "
@@ -639,121 +644,170 @@ msgid ""
639
  "no.of quantities"
640
  msgstr ""
641
 
642
- #: includes/discount-base.php:1174 view/includes/menu.php:13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
643
  msgid "Settings"
644
  msgstr ""
645
 
646
- #: includes/pricing-rules.php:2859 view/view-pricing-rules.php:568
647
  msgid "Buy"
648
  msgstr ""
649
 
650
- #: includes/pricing-rules.php:2863
651
  msgid " less than or equal to "
652
  msgstr ""
653
 
654
- #: includes/pricing-rules.php:2863 includes/pricing-rules.php:2869
655
  msgid " Quantity"
656
  msgstr ""
657
 
658
- #: includes/pricing-rules.php:2866
659
  msgid " Quantity "
660
  msgstr ""
661
 
662
- #: includes/pricing-rules.php:2873
663
  msgid " or more Quantity"
664
  msgstr ""
665
 
666
- #: includes/pricing-rules.php:2882
667
  msgid " any "
668
  msgstr ""
669
 
670
- #: includes/pricing-rules.php:2882
671
  msgid " products from "
672
  msgstr ""
673
 
674
- #: includes/pricing-rules.php:2889
675
  msgid " in each products"
676
  msgstr ""
677
 
678
- #: includes/pricing-rules.php:2901
679
  msgid " and get discount in "
680
  msgstr ""
681
 
682
- #: includes/pricing-rules.php:2904
683
  msgid " first "
684
  msgstr ""
685
 
686
- #: includes/pricing-rules.php:2906 includes/pricing-rules.php:2910
687
  msgid " quantity of product(s) - "
688
  msgstr ""
689
 
690
- #: includes/pricing-rules.php:2908
691
  msgid " after first "
692
  msgstr ""
693
 
694
- #: includes/pricing-rules.php:2926
695
  msgid "Category(ies) "
696
  msgstr ""
697
 
698
- #: includes/pricing-rules.php:2994
699
  msgid "Get "
700
  msgstr ""
701
 
702
- #: includes/pricing-rules.php:2996
703
  #, php-format
704
  msgid "% discount in "
705
  msgstr ""
706
 
707
- #: includes/pricing-rules.php:2999
708
  msgid "same product"
709
  msgstr ""
710
 
711
- #: includes/pricing-rules.php:3001
712
  msgid "any cheapest one from cart"
713
  msgstr ""
714
 
715
- #: includes/pricing-rules.php:3004
716
  msgid "any cheapest one of "
717
  msgstr ""
718
 
719
- #: includes/pricing-rules.php:3009
720
  msgid " quantity of any "
721
  msgstr ""
722
 
723
- #: includes/pricing-rules.php:3011
724
  msgid " cheapest item "
725
  msgstr ""
726
 
727
- #: includes/pricing-rules.php:3014
728
  msgid " quantity of cheapest item "
729
  msgstr ""
730
 
731
- #: includes/pricing-rules.php:3018
732
  msgid "from the category "
733
  msgstr ""
734
 
735
- #: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p7/Plugin/Ui.php:54
736
- msgid "View details"
737
- msgstr ""
738
-
739
- #: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p7/Plugin/Ui.php:77
740
- #, php-format
741
- msgid "More information about %s"
742
- msgstr ""
743
-
744
- #: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p7/Plugin/Ui.php:128
745
- msgid "Check for updates"
746
- msgstr ""
747
-
748
- #: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p7/Plugin/Ui.php:223
749
- #, php-format
750
- msgid "Unknown update checker status \"%s\""
751
- msgstr ""
752
-
753
- #: vendor/yahnis-elsts/plugin-update-checker/Puc/v4p7/Vcs/PluginUpdateChecker.php:98
754
- msgid "There is no changelog available."
755
- msgstr ""
756
-
757
  #: view/cart-rules.php:48
758
  msgid "Cart Rules"
759
  msgstr ""
@@ -956,7 +1010,7 @@ msgid ""
956
  msgstr ""
957
 
958
  #: view/includes/cart-menu.php:9 view/includes/sub-menu.php:9
959
- #: view/settings.php:26 view/view-cart-rules.php:64
960
  #: view/view-pricing-rules.php:47
961
  msgid "General"
962
  msgstr ""
@@ -966,8 +1020,8 @@ msgid "Conditions"
966
  msgstr ""
967
 
968
  #: view/includes/cart-menu.php:13 view/includes/sub-menu.php:13
969
- #: view/template/discount-table.php:27 view/view-cart-rules.php:592
970
- #: view/view-pricing-rules.php:634
971
  msgid "Discount"
972
  msgstr ""
973
 
@@ -1083,7 +1137,7 @@ msgstr ""
1083
  #: view/settings_cart_rules.php:92 view/settings_price_rules.php:313
1084
  #: view/view-pricing-rules.php:300 view/view-pricing-rules.php:357
1085
  #: view/view-pricing-rules.php:427 view/view-pricing-rules.php:475
1086
- #: view/view-pricing-rules.php:504
1087
  msgid "Supported in PRO version"
1088
  msgstr ""
1089
 
@@ -1444,122 +1498,122 @@ msgstr ""
1444
  msgid "Looking for more features? Upgrade to PRO"
1445
  msgstr ""
1446
 
1447
- #: view/view-cart-rules.php:55 view/view-pricing-rules.php:38
1448
  msgid "Close and go back to list"
1449
  msgstr ""
1450
 
1451
- #: view/view-cart-rules.php:59
1452
  msgid "New Cart Rule"
1453
  msgstr ""
1454
 
1455
- #: view/view-cart-rules.php:61
1456
  msgid "Edit Cart Rule"
1457
  msgstr ""
1458
 
1459
- #: view/view-cart-rules.php:74 view/view-pricing-rules.php:57
1460
  msgid "This rule is not running currently: "
1461
  msgstr ""
1462
 
1463
- #: view/view-cart-rules.php:83 view/view-pricing-rules.php:66
1464
  msgid "Priority :"
1465
  msgstr ""
1466
 
1467
- #: view/view-cart-rules.php:85
1468
  msgid ""
1469
  "The Simple Ranking concept to said, which one is going to execute first and "
1470
  "so on."
1471
  msgstr ""
1472
 
1473
- #: view/view-cart-rules.php:97 view/view-pricing-rules.php:81
1474
  msgid "Rule Name"
1475
  msgstr ""
1476
 
1477
- #: view/view-cart-rules.php:99 view/view-cart-rules.php:111
1478
  #: view/view-pricing-rules.php:95
1479
  msgid "Rule Descriptions."
1480
  msgstr ""
1481
 
1482
- #: view/view-cart-rules.php:104 view/view-pricing-rules.php:89
1483
  msgid "ex. Standard Rule."
1484
  msgstr ""
1485
 
1486
- #: view/view-cart-rules.php:109 view/view-pricing-rules.php:94
1487
  msgid "Rule Description"
1488
  msgstr ""
1489
 
1490
- #: view/view-cart-rules.php:120 view/view-pricing-rules.php:130
1491
  msgid "Validity"
1492
  msgstr ""
1493
 
1494
- #: view/view-cart-rules.php:121 view/view-pricing-rules.php:131
1495
  msgid "Period of Rule Active. Format: month/day/Year Hour:Min"
1496
  msgstr ""
1497
 
1498
- #: view/view-cart-rules.php:134 view/view-pricing-rules.php:144
1499
- #: view/view-pricing-rules.php:578
1500
  msgid "From"
1501
  msgstr ""
1502
 
1503
- #: view/view-cart-rules.php:138
1504
  msgid "To"
1505
  msgstr ""
1506
 
1507
- #: view/view-cart-rules.php:139 view/view-pricing-rules.php:149
1508
  #, php-format
1509
  msgid "Current date and time: %s"
1510
  msgstr ""
1511
 
1512
- #: view/view-cart-rules.php:144 view/view-cart-rules.php:586
1513
- #: view/view-pricing-rules.php:183 view/view-pricing-rules.php:627
1514
  msgid "Next"
1515
  msgstr ""
1516
 
1517
- #: view/view-cart-rules.php:148
1518
  msgid "Cart Conditions"
1519
  msgstr ""
1520
 
1521
- #: view/view-cart-rules.php:151
1522
  msgid "Add Condition"
1523
  msgstr ""
1524
 
1525
- #: view/view-cart-rules.php:220
1526
  msgid "Categories In Cart"
1527
  msgstr ""
1528
 
1529
- #: view/view-cart-rules.php:278 view/view-cart-rules.php:280
1530
  msgid "Email with TLD (Eg: edu)"
1531
  msgstr ""
1532
 
1533
- #: view/view-cart-rules.php:585 view/view-cart-rules.php:682
1534
- #: view/view-pricing-rules.php:626 view/view-pricing-rules.php:831
1535
  msgid "Previous"
1536
  msgstr ""
1537
 
1538
- #: view/view-cart-rules.php:588
1539
  msgid "Guide to create cart rules"
1540
  msgstr ""
1541
 
1542
- #: view/view-cart-rules.php:608
1543
  msgid "Discount Type :"
1544
  msgstr ""
1545
 
1546
- #: view/view-cart-rules.php:627 view/view-cart-rules.php:629
1547
  msgid "Product Discount"
1548
  msgstr ""
1549
 
1550
- #: view/view-cart-rules.php:636 view/view-cart-rules.php:638
1551
  msgid "Free shipping"
1552
  msgstr ""
1553
 
1554
- #: view/view-cart-rules.php:647
1555
  msgid "value :"
1556
  msgstr ""
1557
 
1558
- #: view/view-cart-rules.php:655
1559
  msgid "Select products :"
1560
  msgstr ""
1561
 
1562
- #: view/view-cart-rules.php:669
1563
  msgid "Quantity :"
1564
  msgstr ""
1565
 
@@ -1682,10 +1736,6 @@ msgstr ""
1682
  msgid "Check this box to count quantities cumulatively across attribute"
1683
  msgstr ""
1684
 
1685
- #: view/view-pricing-rules.php:270
1686
- msgid "Exclude products"
1687
- msgstr ""
1688
-
1689
  #: view/view-pricing-rules.php:289
1690
  msgid "Exclude sale items"
1691
  msgstr ""
@@ -1698,7 +1748,7 @@ msgstr ""
1698
  msgid "Customers"
1699
  msgstr ""
1700
 
1701
- #: view/view-pricing-rules.php:318 view/view-pricing-rules.php:599
1702
  msgid "All"
1703
  msgstr ""
1704
 
@@ -1751,83 +1801,83 @@ msgstr ""
1751
  msgid "Supported in WooCommerce 3.x"
1752
  msgstr ""
1753
 
1754
- #: view/view-pricing-rules.php:570
1755
  msgid "Any"
1756
  msgstr ""
1757
 
1758
- #: view/view-pricing-rules.php:571
1759
  msgid "Each"
1760
  msgstr ""
1761
 
1762
- #: view/view-pricing-rules.php:572
1763
  msgid "Combine"
1764
  msgstr ""
1765
 
1766
- #: view/view-pricing-rules.php:575
1767
  msgid "More than or equal to"
1768
  msgstr ""
1769
 
1770
- #: view/view-pricing-rules.php:577
1771
  msgid "Equal"
1772
  msgstr ""
1773
 
1774
- #: view/view-pricing-rules.php:580 view/view-pricing-rules.php:583
1775
- #: view/view-pricing-rules.php:603
1776
  msgid "Quantity"
1777
  msgstr ""
1778
 
1779
- #: view/view-pricing-rules.php:582
1780
  msgid "to"
1781
  msgstr ""
1782
 
1783
- #: view/view-pricing-rules.php:586
1784
  msgid "Product(s) from"
1785
  msgstr ""
1786
 
1787
- #: view/view-pricing-rules.php:592
1788
  msgid "Apply discount in product(s)"
1789
  msgstr ""
1790
 
1791
- #: view/view-pricing-rules.php:593
1792
  msgid "Apply discount in category(ies)"
1793
  msgstr ""
1794
 
1795
- #: view/view-pricing-rules.php:597
1796
  msgid "and get discount in "
1797
  msgstr ""
1798
 
1799
- #: view/view-pricing-rules.php:600
1800
  msgid "First quantity(s)"
1801
  msgstr ""
1802
 
1803
- #: view/view-pricing-rules.php:601
1804
  msgid "Skip first quantity(s)"
1805
  msgstr ""
1806
 
1807
- #: view/view-pricing-rules.php:606
1808
  msgid " Product(s) "
1809
  msgstr ""
1810
 
1811
- #: view/view-pricing-rules.php:610
1812
  msgid "Category(ies)"
1813
  msgstr ""
1814
 
1815
- #: view/view-pricing-rules.php:621
1816
  msgid "Guide for product dependent rules"
1817
  msgstr ""
1818
 
1819
- #: view/view-pricing-rules.php:637
1820
  msgid "Add New Range"
1821
  msgstr ""
1822
 
1823
- #: view/view-pricing-rules.php:814
1824
  msgid "Guide to create perfect BOGO rules"
1825
  msgstr ""
1826
 
1827
- #: view/view-pricing-rules.php:824
1828
  msgid "Percent"
1829
  msgstr ""
1830
 
1831
- #: view/view-pricing-rules.php:825
1832
  msgid "Fixed"
1833
  msgstr ""
15
  msgid "Guest"
16
  msgstr ""
17
 
18
+ #: helper/general-helper.php:588
19
  msgid "Start date and time is set in the future date"
20
  msgstr ""
21
 
22
+ #: helper/general-helper.php:591
23
  msgid "Validity expired"
24
  msgstr ""
25
 
26
+ #: helper/general-helper.php:608
27
  msgid "Will run in future"
28
  msgstr ""
29
 
30
+ #: helper/general-helper.php:611
31
  msgid "Not running - validity expired"
32
  msgstr ""
33
 
34
+ #: helper/general-helper.php:628
35
  msgid "Running"
36
  msgstr ""
37
 
38
+ #: helper/general-helper.php:633
39
  msgid "Your server current date and time: "
40
  msgstr ""
41
 
42
+ #: helper/general-helper.php:755
43
  msgid "Read Docs"
44
  msgstr ""
45
 
57
  msgstr ""
58
 
59
  #: helper/purchase.php:60 helper/purchase.php:64 helper/purchase.php:132
60
+ #: helper/purchase.php:135 helper/purchase.php:171
61
  msgid "Please enter a valid license key"
62
  msgstr ""
63
 
95
  msgid "Core"
96
  msgstr ""
97
 
98
+ #: helper/purchase.php:180
99
  msgid "License key check : Passed."
100
  msgstr ""
101
 
102
+ #: helper/purchase.php:184 view/settings_general.php:31
103
  msgid "License key seems to be Invalid. Please enter a valid license key"
104
  msgstr ""
105
 
106
+ #: helper/woo-function.php:471 helper/woo-function.php:481
107
  msgid "Search for a product&hellip;"
108
  msgstr ""
109
 
110
+ #: helper/woo-function.php:514 helper/woo-function.php:526
111
  msgid "Search for a user&hellip;"
112
  msgstr ""
113
 
125
  msgstr ""
126
 
127
  #: includes/advanced/free_shipping_method.php:73
128
+ #: includes/discount-base.php:1049 view/cart-rules.php:133
129
  #: view/pricing-rules.php:163 view/settings_promotion.php:65
130
  #: view/settings_promotion.php:100
131
  msgid "Enable"
143
  msgid "Title to be display on site"
144
  msgstr ""
145
 
146
+ #: includes/discount-base.php:195 view/cart-rules.php:147
147
  #: view/pricing-rules.php:177
148
  msgid "Active"
149
  msgstr ""
150
 
151
+ #: includes/discount-base.php:197 view/cart-rules.php:149
152
  #: view/pricing-rules.php:179 view/settings_cart_rules.php:95
153
  #: view/settings_cart_rules.php:102 view/settings_price_rules.php:169
154
  #: view/settings_promotion.php:22 view/settings_promotion.php:62
156
  msgid "Disabled"
157
  msgstr ""
158
 
159
+ #: includes/discount-base.php:509
160
  msgid "Cache cleared successfully"
161
  msgstr ""
162
 
163
+ #: includes/discount-base.php:511
164
  msgid "Failed to clear cache"
165
  msgstr ""
166
 
167
+ #: includes/discount-base.php:622 includes/discount-base.php:657
168
  msgid "Failed to do action"
169
  msgstr ""
170
 
171
+ #: includes/discount-base.php:661
172
  msgid "Disabled successfully"
173
  msgstr ""
174
 
175
+ #: includes/discount-base.php:664
176
  msgid "Deleted successfully"
177
  msgstr ""
178
 
179
+ #: includes/discount-base.php:667
180
  msgid "Enabled successfully"
181
  msgstr ""
182
 
183
+ #: includes/discount-base.php:687 includes/discount-base.php:688
184
+ #: includes/discount-base.php:705
185
  msgid "copy"
186
  msgstr ""
187
 
188
+ #: includes/discount-base.php:713
189
  msgid "Duplicate rule created successfully"
190
  msgstr ""
191
 
192
+ #: includes/discount-base.php:717
193
  msgid "Failed to create duplicate rule"
194
  msgstr ""
195
 
196
+ #: includes/discount-base.php:1004
197
  msgid "Please fill this field"
198
  msgstr ""
199
 
200
+ #: includes/discount-base.php:1005
201
  msgid "Please Enter the Rule Name to Create / Save."
202
  msgstr ""
203
 
204
+ #: includes/discount-base.php:1006
205
  msgid "Saving..."
206
  msgstr ""
207
 
208
+ #: includes/discount-base.php:1007 view/view-cart-rules.php:55
209
  #: view/view-pricing-rules.php:37
210
  msgid "Save Rule"
211
  msgstr ""
212
 
213
+ #: includes/discount-base.php:1008
214
  msgid "Please enter a Key"
215
  msgstr ""
216
 
217
+ #: includes/discount-base.php:1009 view/view-pricing-rules.php:675
218
  msgid "Min Quantity"
219
  msgstr ""
220
 
221
+ #: includes/discount-base.php:1010 view/view-pricing-rules.php:682
222
  msgid "Max Quantity"
223
  msgstr ""
224
 
225
+ #: includes/discount-base.php:1011 view/view-cart-rules.php:92
226
+ #: view/view-pricing-rules.php:74 view/view-pricing-rules.php:680
227
+ #: view/view-pricing-rules.php:753 view/view-pricing-rules.php:770
228
+ #: view/view-pricing-rules.php:777
229
  msgid "ex. 1"
230
  msgstr ""
231
 
232
+ #: includes/discount-base.php:1012 view/view-pricing-rules.php:815
233
  msgid "ex. 10"
234
  msgstr ""
235
 
236
+ #: includes/discount-base.php:1013 view/view-pricing-rules.php:687
237
+ #: view/view-pricing-rules.php:729
238
  msgid "ex. 50"
239
  msgstr ""
240
 
241
+ #: includes/discount-base.php:1014
242
  msgid "Search for a user"
243
  msgstr ""
244
 
245
+ #: includes/discount-base.php:1015 view/view-pricing-rules.php:688
246
  msgid "Adjustment Type"
247
  msgstr ""
248
 
249
+ #: includes/discount-base.php:1016 view/view-pricing-rules.php:804
250
  msgid "Discount percentage"
251
  msgstr ""
252
 
253
+ #: includes/discount-base.php:1017 view/view-cart-rules.php:700
254
+ #: view/view-pricing-rules.php:694
255
  msgid "Percentage Discount"
256
  msgstr ""
257
 
258
+ #: includes/discount-base.php:1018 view/view-cart-rules.php:706
259
+ #: view/view-cart-rules.php:708 view/view-pricing-rules.php:702
260
+ #: view/view-pricing-rules.php:704
261
  msgid "Price Discount"
262
  msgstr ""
263
 
264
+ #: includes/discount-base.php:1019 view/view-pricing-rules.php:712
265
+ #: view/view-pricing-rules.php:714
266
  msgid "BOGO Product Discount"
267
  msgstr ""
268
 
269
+ #: includes/discount-base.php:1020
270
  msgid "Product Discount - Not support for subtotal based rule"
271
  msgstr ""
272
 
273
+ #: includes/discount-base.php:1021 view/view-cart-rules.php:436
274
+ #: view/view-pricing-rules.php:724 view/view-pricing-rules.php:844
275
  msgid "Value"
276
  msgstr ""
277
 
278
+ #: includes/discount-base.php:1022 view/view-pricing-rules.php:736
279
  msgid "receive discount for"
280
  msgstr ""
281
 
282
+ #: includes/discount-base.php:1023 view/view-pricing-rules.php:738
283
  msgid "Auto add all selected products"
284
  msgstr ""
285
 
286
+ #: includes/discount-base.php:1024 view/view-pricing-rules.php:739
287
  msgid "Same product"
288
  msgstr ""
289
 
290
+ #: includes/discount-base.php:1025 view/view-pricing-rules.php:740
291
  msgid "Any one cheapest from selected"
292
  msgstr ""
293
 
294
+ #: includes/discount-base.php:1026 view/view-pricing-rules.php:741
295
  msgid "Any one cheapest from all products"
296
  msgstr ""
297
 
298
+ #: includes/discount-base.php:1027 view/view-pricing-rules.php:742
299
  msgid "Cheapest in cart - selected category(ies)"
300
  msgstr ""
301
 
302
+ #: includes/discount-base.php:1028 view/view-pricing-rules.php:743
303
  msgid "Cheapest in cart - selected item(s)"
304
  msgstr ""
305
 
306
+ #: includes/discount-base.php:1029 view/view-pricing-rules.php:744
307
  msgid "Cheapest among all items in cart"
308
  msgstr ""
309
 
310
+ #: includes/discount-base.php:1030 view/view-pricing-rules.php:748
311
  msgid "Free quantity"
312
  msgstr ""
313
 
314
+ #: includes/discount-base.php:1031 view/view-pricing-rules.php:748
315
  msgid "Number of quantity(ies) in each selected product(s)"
316
  msgstr ""
317
 
318
+ #: includes/discount-base.php:1032 view/view-pricing-rules.php:762
319
  msgid "Fixed item count (not recommended)"
320
  msgstr ""
321
 
322
+ #: includes/discount-base.php:1033 view/view-pricing-rules.php:761
323
  msgid "Dynamic item count"
324
  msgstr ""
325
 
326
+ #: includes/discount-base.php:1034 view/view-pricing-rules.php:764
327
  msgid ""
328
  "Fixed item count - You need to provide item count manually. Dynamic item "
329
  "count - System will choose dynamically based on cart"
330
  msgstr ""
331
 
332
+ #: includes/discount-base.php:1035 view/view-pricing-rules.php:765
333
  msgid "Item count"
334
  msgstr ""
335
 
336
+ #: includes/discount-base.php:1036 view/view-pricing-rules.php:765
337
  msgid "Discount for number of item(s) in cart"
338
  msgstr ""
339
 
340
+ #: includes/discount-base.php:1037 view/view-pricing-rules.php:772
341
  msgid "Discount for number of quantity(ies) in each item"
342
  msgstr ""
343
 
344
+ #: includes/discount-base.php:1038 view/view-pricing-rules.php:772
345
  msgid "Item quantity"
346
  msgstr ""
347
 
348
+ #: includes/discount-base.php:1039
349
  msgid "Search for a products"
350
  msgstr ""
351
 
352
+ #: includes/discount-base.php:1040
353
  msgid "and"
354
  msgstr ""
355
 
356
+ #: includes/discount-base.php:1041 view/view-pricing-rules.php:806
357
  msgid "100% percent"
358
  msgstr ""
359
 
360
+ #: includes/discount-base.php:1042 view/view-pricing-rules.php:807
361
  msgid "Limited percent"
362
  msgstr ""
363
 
364
+ #: includes/discount-base.php:1043
365
  msgid "Percentage"
366
  msgstr ""
367
 
368
+ #: includes/discount-base.php:1044
369
  msgid "as discount"
370
  msgstr ""
371
 
372
+ #: includes/discount-base.php:1045 view/view-cart-rules.php:663
373
+ #: view/view-pricing-rules.php:821
374
  msgid "Remove"
375
  msgstr ""
376
 
377
+ #: includes/discount-base.php:1046 view/cart-rules.php:170
378
+ #: view/pricing-rules.php:200 view/view-pricing-rules.php:824
379
  msgid "Duplicate"
380
  msgstr ""
381
 
382
+ #: includes/discount-base.php:1047
383
  msgid "none"
384
  msgstr ""
385
 
386
+ #: includes/discount-base.php:1048
387
  msgid "Are you sure to remove this ?"
388
  msgstr ""
389
 
390
+ #: includes/discount-base.php:1050 view/cart-rules.php:130
391
  #: view/pricing-rules.php:160
392
  msgid "Disable"
393
  msgstr ""
394
 
395
+ #: includes/discount-base.php:1051
396
  msgid "Are you sure to remove ?"
397
  msgstr ""
398
 
399
+ #: includes/discount-base.php:1052 view/view-cart-rules.php:172
400
  msgid "Type"
401
  msgstr ""
402
 
403
+ #: includes/discount-base.php:1053 view/view-cart-rules.php:176
404
  msgid "Cart Subtotal"
405
  msgstr ""
406
 
407
+ #: includes/discount-base.php:1054 view/view-cart-rules.php:179
408
  msgid "Subtotal at least"
409
  msgstr ""
410
 
411
+ #: includes/discount-base.php:1055 view/view-cart-rules.php:183
412
  msgid "Subtotal less than"
413
  msgstr ""
414
 
415
+ #: includes/discount-base.php:1056 view/view-cart-rules.php:186
416
  msgid "Cart Item Count"
417
  msgstr ""
418
 
419
+ #: includes/discount-base.php:1057 view/view-cart-rules.php:189
420
  msgid "Number of line items in the cart (not quantity) at least"
421
  msgstr ""
422
 
423
+ #: includes/discount-base.php:1058 view/view-cart-rules.php:193
424
  msgid "Number of line items in the cart (not quantity) less than"
425
  msgstr ""
426
 
427
+ #: includes/discount-base.php:1059 view/view-cart-rules.php:196
428
  msgid "Quantity Sum"
429
  msgstr ""
430
 
431
+ #: includes/discount-base.php:1060 view/view-cart-rules.php:202
432
+ #: view/view-cart-rules.php:205
433
  msgid "Total number of quantities in the cart at least"
434
  msgstr ""
435
 
436
+ #: includes/discount-base.php:1061 view/view-cart-rules.php:214
437
+ #: view/view-cart-rules.php:217
438
  msgid "Total number of quantities in the cart less than"
439
  msgstr ""
440
 
441
+ #: includes/discount-base.php:1062 view/view-cart-rules.php:246
442
  msgid "Categories in cart"
443
  msgstr ""
444
 
445
+ #: includes/discount-base.php:1063 view/view-cart-rules.php:252
446
  msgid "Including sub-categories in cart"
447
  msgstr ""
448
 
449
+ #: includes/discount-base.php:1064 view/view-cart-rules.php:261
450
  msgid "Customer Details (must be logged in)"
451
  msgstr ""
452
 
453
+ #: includes/discount-base.php:1065 view/view-cart-rules.php:267
454
+ #: view/view-cart-rules.php:269
455
  msgid "User in list"
456
  msgstr ""
457
 
458
+ #: includes/discount-base.php:1066 view/view-cart-rules.php:277
459
+ #: view/view-cart-rules.php:279
460
  msgid "User role in list"
461
  msgstr ""
462
 
463
+ #: includes/discount-base.php:1067 view/view-cart-rules.php:287
464
+ #: view/view-cart-rules.php:289
465
  msgid "Shipping country in list"
466
  msgstr ""
467
 
468
+ #: includes/discount-base.php:1068 view/view-cart-rules.php:293
469
  msgid "Customer Email"
470
  msgstr ""
471
 
472
+ #: includes/discount-base.php:1069
473
  msgid "Email with TLD (Ege: edu)"
474
  msgstr ""
475
 
476
+ #: includes/discount-base.php:1070 view/view-cart-rules.php:309
477
+ #: view/view-cart-rules.php:311
478
  msgid "Email with Domain (Eg: gmail.com)"
479
  msgstr ""
480
 
481
+ #: includes/discount-base.php:1071 view/view-cart-rules.php:315
482
  msgid "Customer Billing Details"
483
  msgstr ""
484
 
485
+ #: includes/discount-base.php:1072 view/view-cart-rules.php:321
486
+ #: view/view-cart-rules.php:323
487
  msgid "Billing city"
488
  msgstr ""
489
 
490
+ #: includes/discount-base.php:1073 view/view-cart-rules.php:327
491
  msgid "Customer Shipping Details"
492
  msgstr ""
493
 
494
+ #: includes/discount-base.php:1074 view/view-cart-rules.php:333
495
+ #: view/view-cart-rules.php:335
496
  msgid "Shipping state"
497
  msgstr ""
498
 
499
+ #: includes/discount-base.php:1075 view/view-cart-rules.php:343
500
+ #: view/view-cart-rules.php:345
501
  msgid "Shipping city"
502
  msgstr ""
503
 
504
+ #: includes/discount-base.php:1076 view/view-cart-rules.php:353
505
+ #: view/view-cart-rules.php:355
506
  msgid "Shipping zip code"
507
  msgstr ""
508
 
509
+ #: includes/discount-base.php:1077 view/view-cart-rules.php:359
510
  #: view/view-pricing-rules.php:486
511
  msgid "Purchase History"
512
  msgstr ""
513
 
514
+ #: includes/discount-base.php:1078 view/view-cart-rules.php:365
515
+ #: view/view-cart-rules.php:367 view/view-pricing-rules.php:494
516
  msgid "Purchased amount"
517
  msgstr ""
518
 
519
+ #: includes/discount-base.php:1079 view/view-cart-rules.php:375
520
+ #: view/view-cart-rules.php:377 view/view-pricing-rules.php:495
521
  msgid "Number of previous orders made"
522
  msgstr ""
523
 
524
+ #: includes/discount-base.php:1080 view/view-cart-rules.php:385
525
+ #: view/view-cart-rules.php:387 view/view-pricing-rules.php:496
526
  msgid "Number of previous orders made with following products"
527
  msgstr ""
528
 
529
+ #: includes/discount-base.php:1081 view/view-cart-rules.php:395
530
+ #: view/view-cart-rules.php:397 view/view-pricing-rules.php:497
531
+ msgid "Number of quantity(s) in previous orders made with following products"
532
+ msgstr ""
533
+
534
+ #: includes/discount-base.php:1082 view/view-cart-rules.php:401
535
  msgid "Coupon applied"
536
  msgstr ""
537
 
538
+ #: includes/discount-base.php:1083 view/view-cart-rules.php:407
539
+ #: view/view-cart-rules.php:409
540
  msgid "Atleast any one"
541
  msgstr ""
542
 
543
+ #: includes/discount-base.php:1084 view/view-cart-rules.php:417
544
+ #: view/view-cart-rules.php:419
545
  msgid "All selected"
546
  msgstr ""
547
 
548
+ #: includes/discount-base.php:1085 view/view-cart-rules.php:618
549
+ #: view/view-pricing-rules.php:534
550
  msgid "Greater than or equal to"
551
  msgstr ""
552
 
553
+ #: includes/discount-base.php:1086 view/view-cart-rules.php:619
554
+ #: view/view-pricing-rules.php:535 view/view-pricing-rules.php:594
555
  msgid "Less than or equal to"
556
  msgstr ""
557
 
558
+ #: includes/discount-base.php:1087 view/view-cart-rules.php:621
559
+ #: view/view-pricing-rules.php:538
560
  msgid "and the order status should be"
561
  msgstr ""
562
 
563
+ #: includes/discount-base.php:1088 view/cart-rules.php:114
564
  #: view/cart-rules.php:209 view/pricing-rules.php:144
565
+ #: view/pricing-rules.php:239 view/view-cart-rules.php:662
566
  msgid "Action"
567
  msgstr ""
568
 
569
+ #: includes/discount-base.php:1089 view/settings.php:21
570
  #: view/settings_taxonomy.php:21
571
  msgid "Save"
572
  msgstr ""
573
 
574
+ #: includes/discount-base.php:1090
575
  msgid "Saved Successfully!"
576
  msgstr ""
577
 
578
+ #: includes/discount-base.php:1091 view/view-cart-rules.php:465
579
+ #: view/view-cart-rules.php:533 view/view-cart-rules.php:553
580
+ #: view/view-cart-rules.php:574 view/view-cart-rules.php:626
581
  #: view/view-pricing-rules.php:235 view/view-pricing-rules.php:251
582
+ #: view/view-pricing-rules.php:546 view/view-pricing-rules.php:630
583
+ #: view/view-pricing-rules.php:792
584
  msgid "None selected"
585
  msgstr ""
586
 
587
+ #: includes/discount-base.php:1092 view/view-cart-rules.php:258
588
  msgid "In each category"
589
  msgstr ""
590
 
591
+ #: includes/discount-base.php:1093 view/settings_price_rules.php:208
592
  #: view/settings_price_rules.php:226 view/settings_price_rules.php:244
593
  #: view/settings_price_rules.php:262
594
  msgid "Show"
595
  msgstr ""
596
 
597
+ #: includes/discount-base.php:1094 view/template/sidebar.php:12
598
  msgid "Hide"
599
  msgstr ""
600
 
601
+ #: includes/discount-base.php:1095
602
  msgid "Please select at least one rule"
603
  msgstr ""
604
 
605
+ #: includes/discount-base.php:1096
606
  msgid "Please select an action to apply"
607
  msgstr ""
608
 
609
+ #: includes/discount-base.php:1097
610
  msgid "Are you sure to remove the selected rules"
611
  msgstr ""
612
 
613
+ #: includes/discount-base.php:1098 view/view-pricing-rules.php:781
614
  msgid "Choose product(s)"
615
  msgstr ""
616
 
617
+ #: includes/discount-base.php:1099 view/view-pricing-rules.php:791
618
  msgid "Choose category(ies)"
619
  msgstr ""
620
 
621
+ #: includes/discount-base.php:1100
622
  msgid "Search for a coupon"
623
  msgstr ""
624
 
625
+ #: includes/discount-base.php:1101 view/view-pricing-rules.php:720
626
+ #: view/view-pricing-rules.php:815
627
  #, php-format
628
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
629
  msgstr ""
630
 
631
+ #: includes/discount-base.php:1102 view/view-pricing-rules.php:721
632
  #, php-format
633
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
634
  msgstr ""
635
 
636
+ #: includes/discount-base.php:1103 view/view-pricing-rules.php:746
637
  msgid ""
638
  "Auto add all selected products - Automatically added to the cart <br> Same "
639
  "product - get discount in same product <br> Any one cheapest from selected - "
644
  "no.of quantities"
645
  msgstr ""
646
 
647
+ #: includes/discount-base.php:1104 view/view-cart-rules.php:221
648
+ msgid "Products"
649
+ msgstr ""
650
+
651
+ #: includes/discount-base.php:1105 view/view-cart-rules.php:226
652
+ msgid "Products in cart"
653
+ msgstr ""
654
+
655
+ #: includes/discount-base.php:1106 view/view-cart-rules.php:232
656
+ #: view/view-pricing-rules.php:270
657
+ msgid "Exclude products"
658
+ msgstr ""
659
+
660
+ #: includes/discount-base.php:1107 view/view-cart-rules.php:238
661
+ msgid "Exclude on sale products"
662
+ msgstr ""
663
+
664
+ #: includes/discount-base.php:1108 view/view-cart-rules.php:503
665
+ msgid "This will exclude the on sale products from discount"
666
+ msgstr ""
667
+
668
+ #: includes/discount-base.php:1109 view/view-cart-rules.php:634
669
+ #: view/view-pricing-rules.php:553
670
+ msgid "From all previous orders"
671
+ msgstr ""
672
+
673
+ #: includes/discount-base.php:1110 view/view-cart-rules.php:635
674
+ #: view/view-pricing-rules.php:554
675
+ msgid "Last 7 days"
676
+ msgstr ""
677
+
678
+ #: includes/discount-base.php:1111 view/view-cart-rules.php:636
679
+ #: view/view-pricing-rules.php:555
680
+ msgid "Last 14 days"
681
+ msgstr ""
682
+
683
+ #: includes/discount-base.php:1112 view/view-cart-rules.php:637
684
+ #: view/view-pricing-rules.php:556
685
+ msgid "Last 30 days"
686
+ msgstr ""
687
+
688
+ #: includes/discount-base.php:1113 view/view-cart-rules.php:638
689
+ #: view/view-pricing-rules.php:557
690
+ msgid "Last 60 days"
691
+ msgstr ""
692
+
693
+ #: includes/discount-base.php:1114 view/view-cart-rules.php:639
694
+ #: view/view-pricing-rules.php:558
695
+ msgid "Last 90 days"
696
+ msgstr ""
697
+
698
+ #: includes/discount-base.php:1115 view/view-cart-rules.php:640
699
+ #: view/view-pricing-rules.php:559
700
+ msgid "Last 180 days"
701
+ msgstr ""
702
+
703
+ #: includes/discount-base.php:1116 view/view-cart-rules.php:641
704
+ #: view/view-pricing-rules.php:560
705
+ msgid "Last 1 year"
706
+ msgstr ""
707
+
708
+ #: includes/discount-base.php:1117 view/view-cart-rules.php:642
709
+ #: view/view-pricing-rules.php:561
710
+ msgid "Custom"
711
+ msgstr ""
712
+
713
+ #: includes/discount-base.php:1118 view/view-cart-rules.php:645
714
+ #: view/view-pricing-rules.php:565
715
+ msgid "in days"
716
+ msgstr ""
717
+
718
+ #: includes/discount-base.php:1196 view/includes/menu.php:13
719
  msgid "Settings"
720
  msgstr ""
721
 
722
+ #: includes/pricing-rules.php:2881 view/view-pricing-rules.php:586
723
  msgid "Buy"
724
  msgstr ""
725
 
726
+ #: includes/pricing-rules.php:2885
727
  msgid " less than or equal to "
728
  msgstr ""
729
 
730
+ #: includes/pricing-rules.php:2885 includes/pricing-rules.php:2891
731
  msgid " Quantity"
732
  msgstr ""
733
 
734
+ #: includes/pricing-rules.php:2888
735
  msgid " Quantity "
736
  msgstr ""
737
 
738
+ #: includes/pricing-rules.php:2895
739
  msgid " or more Quantity"
740
  msgstr ""
741
 
742
+ #: includes/pricing-rules.php:2904
743
  msgid " any "
744
  msgstr ""
745
 
746
+ #: includes/pricing-rules.php:2904
747
  msgid " products from "
748
  msgstr ""
749
 
750
+ #: includes/pricing-rules.php:2911
751
  msgid " in each products"
752
  msgstr ""
753
 
754
+ #: includes/pricing-rules.php:2923
755
  msgid " and get discount in "
756
  msgstr ""
757
 
758
+ #: includes/pricing-rules.php:2926
759
  msgid " first "
760
  msgstr ""
761
 
762
+ #: includes/pricing-rules.php:2928 includes/pricing-rules.php:2932
763
  msgid " quantity of product(s) - "
764
  msgstr ""
765
 
766
+ #: includes/pricing-rules.php:2930
767
  msgid " after first "
768
  msgstr ""
769
 
770
+ #: includes/pricing-rules.php:2948
771
  msgid "Category(ies) "
772
  msgstr ""
773
 
774
+ #: includes/pricing-rules.php:3016
775
  msgid "Get "
776
  msgstr ""
777
 
778
+ #: includes/pricing-rules.php:3018
779
  #, php-format
780
  msgid "% discount in "
781
  msgstr ""
782
 
783
+ #: includes/pricing-rules.php:3021
784
  msgid "same product"
785
  msgstr ""
786
 
787
+ #: includes/pricing-rules.php:3023
788
  msgid "any cheapest one from cart"
789
  msgstr ""
790
 
791
+ #: includes/pricing-rules.php:3026
792
  msgid "any cheapest one of "
793
  msgstr ""
794
 
795
+ #: includes/pricing-rules.php:3031
796
  msgid " quantity of any "
797
  msgstr ""
798
 
799
+ #: includes/pricing-rules.php:3033
800
  msgid " cheapest item "
801
  msgstr ""
802
 
803
+ #: includes/pricing-rules.php:3036
804
  msgid " quantity of cheapest item "
805
  msgstr ""
806
 
807
+ #: includes/pricing-rules.php:3040
808
  msgid "from the category "
809
  msgstr ""
810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
  #: view/cart-rules.php:48
812
  msgid "Cart Rules"
813
  msgstr ""
1010
  msgstr ""
1011
 
1012
  #: view/includes/cart-menu.php:9 view/includes/sub-menu.php:9
1013
+ #: view/settings.php:26 view/view-cart-rules.php:65
1014
  #: view/view-pricing-rules.php:47
1015
  msgid "General"
1016
  msgstr ""
1020
  msgstr ""
1021
 
1022
  #: view/includes/cart-menu.php:13 view/includes/sub-menu.php:13
1023
+ #: view/template/discount-table.php:27 view/view-cart-rules.php:680
1024
+ #: view/view-pricing-rules.php:652
1025
  msgid "Discount"
1026
  msgstr ""
1027
 
1137
  #: view/settings_cart_rules.php:92 view/settings_price_rules.php:313
1138
  #: view/view-pricing-rules.php:300 view/view-pricing-rules.php:357
1139
  #: view/view-pricing-rules.php:427 view/view-pricing-rules.php:475
1140
+ #: view/view-pricing-rules.php:505
1141
  msgid "Supported in PRO version"
1142
  msgstr ""
1143
 
1498
  msgid "Looking for more features? Upgrade to PRO"
1499
  msgstr ""
1500
 
1501
+ #: view/view-cart-rules.php:56 view/view-pricing-rules.php:38
1502
  msgid "Close and go back to list"
1503
  msgstr ""
1504
 
1505
+ #: view/view-cart-rules.php:60
1506
  msgid "New Cart Rule"
1507
  msgstr ""
1508
 
1509
+ #: view/view-cart-rules.php:62
1510
  msgid "Edit Cart Rule"
1511
  msgstr ""
1512
 
1513
+ #: view/view-cart-rules.php:75 view/view-pricing-rules.php:57
1514
  msgid "This rule is not running currently: "
1515
  msgstr ""
1516
 
1517
+ #: view/view-cart-rules.php:84 view/view-pricing-rules.php:66
1518
  msgid "Priority :"
1519
  msgstr ""
1520
 
1521
+ #: view/view-cart-rules.php:86
1522
  msgid ""
1523
  "The Simple Ranking concept to said, which one is going to execute first and "
1524
  "so on."
1525
  msgstr ""
1526
 
1527
+ #: view/view-cart-rules.php:98 view/view-pricing-rules.php:81
1528
  msgid "Rule Name"
1529
  msgstr ""
1530
 
1531
+ #: view/view-cart-rules.php:100 view/view-cart-rules.php:112
1532
  #: view/view-pricing-rules.php:95
1533
  msgid "Rule Descriptions."
1534
  msgstr ""
1535
 
1536
+ #: view/view-cart-rules.php:105 view/view-pricing-rules.php:89
1537
  msgid "ex. Standard Rule."
1538
  msgstr ""
1539
 
1540
+ #: view/view-cart-rules.php:110 view/view-pricing-rules.php:94
1541
  msgid "Rule Description"
1542
  msgstr ""
1543
 
1544
+ #: view/view-cart-rules.php:121 view/view-pricing-rules.php:130
1545
  msgid "Validity"
1546
  msgstr ""
1547
 
1548
+ #: view/view-cart-rules.php:122 view/view-pricing-rules.php:131
1549
  msgid "Period of Rule Active. Format: month/day/Year Hour:Min"
1550
  msgstr ""
1551
 
1552
+ #: view/view-cart-rules.php:135 view/view-pricing-rules.php:144
1553
+ #: view/view-pricing-rules.php:596
1554
  msgid "From"
1555
  msgstr ""
1556
 
1557
+ #: view/view-cart-rules.php:139
1558
  msgid "To"
1559
  msgstr ""
1560
 
1561
+ #: view/view-cart-rules.php:140 view/view-pricing-rules.php:149
1562
  #, php-format
1563
  msgid "Current date and time: %s"
1564
  msgstr ""
1565
 
1566
+ #: view/view-cart-rules.php:145 view/view-cart-rules.php:674
1567
+ #: view/view-pricing-rules.php:183 view/view-pricing-rules.php:645
1568
  msgid "Next"
1569
  msgstr ""
1570
 
1571
+ #: view/view-cart-rules.php:149
1572
  msgid "Cart Conditions"
1573
  msgstr ""
1574
 
1575
+ #: view/view-cart-rules.php:152
1576
  msgid "Add Condition"
1577
  msgstr ""
1578
 
1579
+ #: view/view-cart-rules.php:241
1580
  msgid "Categories In Cart"
1581
  msgstr ""
1582
 
1583
+ #: view/view-cart-rules.php:299 view/view-cart-rules.php:301
1584
  msgid "Email with TLD (Eg: edu)"
1585
  msgstr ""
1586
 
1587
+ #: view/view-cart-rules.php:673 view/view-cart-rules.php:770
1588
+ #: view/view-pricing-rules.php:644 view/view-pricing-rules.php:849
1589
  msgid "Previous"
1590
  msgstr ""
1591
 
1592
+ #: view/view-cart-rules.php:676
1593
  msgid "Guide to create cart rules"
1594
  msgstr ""
1595
 
1596
+ #: view/view-cart-rules.php:696
1597
  msgid "Discount Type :"
1598
  msgstr ""
1599
 
1600
+ #: view/view-cart-rules.php:715 view/view-cart-rules.php:717
1601
  msgid "Product Discount"
1602
  msgstr ""
1603
 
1604
+ #: view/view-cart-rules.php:724 view/view-cart-rules.php:726
1605
  msgid "Free shipping"
1606
  msgstr ""
1607
 
1608
+ #: view/view-cart-rules.php:735
1609
  msgid "value :"
1610
  msgstr ""
1611
 
1612
+ #: view/view-cart-rules.php:743
1613
  msgid "Select products :"
1614
  msgstr ""
1615
 
1616
+ #: view/view-cart-rules.php:757
1617
  msgid "Quantity :"
1618
  msgstr ""
1619
 
1736
  msgid "Check this box to count quantities cumulatively across attribute"
1737
  msgstr ""
1738
 
 
 
 
 
1739
  #: view/view-pricing-rules.php:289
1740
  msgid "Exclude sale items"
1741
  msgstr ""
1748
  msgid "Customers"
1749
  msgstr ""
1750
 
1751
+ #: view/view-pricing-rules.php:318 view/view-pricing-rules.php:617
1752
  msgid "All"
1753
  msgstr ""
1754
 
1801
  msgid "Supported in WooCommerce 3.x"
1802
  msgstr ""
1803
 
1804
+ #: view/view-pricing-rules.php:588
1805
  msgid "Any"
1806
  msgstr ""
1807
 
1808
+ #: view/view-pricing-rules.php:589
1809
  msgid "Each"
1810
  msgstr ""
1811
 
1812
+ #: view/view-pricing-rules.php:590
1813
  msgid "Combine"
1814
  msgstr ""
1815
 
1816
+ #: view/view-pricing-rules.php:593
1817
  msgid "More than or equal to"
1818
  msgstr ""
1819
 
1820
+ #: view/view-pricing-rules.php:595
1821
  msgid "Equal"
1822
  msgstr ""
1823
 
1824
+ #: view/view-pricing-rules.php:598 view/view-pricing-rules.php:601
1825
+ #: view/view-pricing-rules.php:621
1826
  msgid "Quantity"
1827
  msgstr ""
1828
 
1829
+ #: view/view-pricing-rules.php:600
1830
  msgid "to"
1831
  msgstr ""
1832
 
1833
+ #: view/view-pricing-rules.php:604
1834
  msgid "Product(s) from"
1835
  msgstr ""
1836
 
1837
+ #: view/view-pricing-rules.php:610
1838
  msgid "Apply discount in product(s)"
1839
  msgstr ""
1840
 
1841
+ #: view/view-pricing-rules.php:611
1842
  msgid "Apply discount in category(ies)"
1843
  msgstr ""
1844
 
1845
+ #: view/view-pricing-rules.php:615
1846
  msgid "and get discount in "
1847
  msgstr ""
1848
 
1849
+ #: view/view-pricing-rules.php:618
1850
  msgid "First quantity(s)"
1851
  msgstr ""
1852
 
1853
+ #: view/view-pricing-rules.php:619
1854
  msgid "Skip first quantity(s)"
1855
  msgstr ""
1856
 
1857
+ #: view/view-pricing-rules.php:624
1858
  msgid " Product(s) "
1859
  msgstr ""
1860
 
1861
+ #: view/view-pricing-rules.php:628
1862
  msgid "Category(ies)"
1863
  msgstr ""
1864
 
1865
+ #: view/view-pricing-rules.php:639
1866
  msgid "Guide for product dependent rules"
1867
  msgstr ""
1868
 
1869
+ #: view/view-pricing-rules.php:655
1870
  msgid "Add New Range"
1871
  msgstr ""
1872
 
1873
+ #: view/view-pricing-rules.php:832
1874
  msgid "Guide to create perfect BOGO rules"
1875
  msgstr ""
1876
 
1877
+ #: view/view-pricing-rules.php:842
1878
  msgid "Percent"
1879
  msgstr ""
1880
 
1881
+ #: view/view-pricing-rules.php:843
1882
  msgid "Fixed"
1883
  msgstr ""
includes/cart-rules.php CHANGED
@@ -50,7 +50,8 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
50
  public $discount_total = 0;
51
  public $product_discount_total = 0;
52
 
53
- public $has_category_in_rule = 0;
 
54
 
55
  /**
56
  * @var array
@@ -78,6 +79,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
78
  public $bogo_coupon_codes = array();
79
  public static $applied_coupon = array();
80
 
 
 
 
81
  /**
82
  * FlycartWooDiscountRulesCartRules constructor.
83
  */
@@ -177,6 +181,17 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
177
  $request['discount_rule'][$index] = FlycartWooDiscountRulesGeneralHelper::makeString($value);
178
  }
179
 
 
 
 
 
 
 
 
 
 
 
 
180
  if (isset($request['discount_rule'])) $request['discount_rule'] = json_encode($request['discount_rule']);
181
 
182
  if (is_null($id) || !isset($id)) return false;
@@ -731,15 +746,16 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
731
  }
732
  } else {
733
  //we will have to re-calculate the sub-total if it has category selected
734
- if($this->is_category_specific($rule)) {
 
 
735
  if(!empty($this->cart_items)){
736
  if(!did_action('woocommerce_before_calculate_totals')){
737
  do_action('woocommerce_before_calculate_totals', FlycartWoocommerceCart::get_cart_object());
738
  }
739
  }
740
- $this->has_category_in_rule = 1;
741
  //re-calculate the sub-total
742
- $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule));
743
  } else {
744
  $subtotal = $this->sub_total;
745
  }
@@ -773,10 +789,11 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
773
  }
774
  } else {
775
  //we will have to re-calculate the sub-total if it has category selected
776
- if($this->is_category_specific($rule)) {
777
- $this->has_category_in_rule = 1;
 
778
  //re-calculate the sub-total
779
- $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule));
780
  }else {
781
  $subtotal = $this->sub_total;
782
  }
@@ -811,10 +828,11 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
811
  }
812
  } else {
813
  //we will have to re-calculate the sub-total if it has category selected
814
- if($this->is_category_specific($rule)) {
815
- $this->has_category_in_rule = 1;
 
816
  //re-calculate the sub-total
817
- $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule));
818
  }else {
819
  $subtotal = $this->sub_total;
820
  }
@@ -851,6 +869,38 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
851
  return false;
852
  }
853
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
  /**
855
  * get discount categories from rule
856
  * */
@@ -893,14 +943,16 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
893
  */
894
  public function validateCart($rules)
895
  {
 
896
  $this->calculateCartSubtotal();
897
  $rules = (is_string($rules) ? json_decode($rules, true) : array());
 
898
  // Simple array helper to re-arrange the structure.
899
  FlycartWooDiscountRulesGeneralHelper::reArrangeArray($rules);
900
  if(is_array($rules) && count($rules)){
901
  foreach ($rules as $index => $rule) {
902
  // Validating the Rules one by one.
903
- if ($this->applyRule($index, $rule, $rules) == false) {
904
  return false;
905
  }
906
  }
@@ -915,9 +967,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
915
  * @param array $rule array of rule info.
916
  * @return bool true|false as matched or not.
917
  */
918
- public function applyRule($index, $rule, $rules)
919
  {
920
- $skipRuleType = array('categories_in', 'in_each_category', 'atleast_one_including_sub_categories');
921
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
922
  switch ($index) {
923
 
@@ -1234,27 +1286,14 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1234
  }
1235
  return false;
1236
  break;
 
 
 
1237
  case 'categories_in':
1238
- if(count($rule)){
1239
- $ruleSuccess = $this->validateCartItemsInSelectedCategory($index, $rule, $rules);
1240
- if($ruleSuccess){
1241
- return true;
1242
- }
1243
- }
1244
- return false;
1245
- break;
1246
  case 'atleast_one_including_sub_categories':
1247
- if(count($rule)){
1248
- $ruleSuccess = $this->validateCartItemsInSelectedCategory($index, $rule, $rules, 1);
1249
- if($ruleSuccess){
1250
- return true;
1251
- }
1252
- }
1253
- return false;
1254
- break;
1255
  case 'in_each_category':
1256
  if(count($rule)){
1257
- $ruleSuccess = $this->validateCartItemsInEachSelectedCategory($index, $rule, $rules);
1258
  if($ruleSuccess){
1259
  return true;
1260
  }
@@ -1264,6 +1303,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1264
  case 'customer_based_on_purchase_history':
1265
  case 'customer_based_on_purchase_history_order_count':
1266
  case 'customer_based_on_purchase_history_product_order_count':
 
1267
  if(count($rule)){
1268
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
1269
  if($ruleSuccess){
@@ -1387,29 +1427,53 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1387
  $purchase_history_status_list = isset($rule['purchase_history_order_status'])? $rule['purchase_history_order_status']: array('wc-completed');
1388
  if(isset($rule['purchased_history_amount'])){
1389
  if($rule['purchased_history_amount'] >= 0){
 
 
 
 
 
 
 
 
1390
  if(!empty($email)){
1391
- $customerOrders = get_posts( array(
1392
- 'numberposts' => -1,
1393
- 'meta_key' => '_billing_email',
1394
- 'meta_value' => $email,
1395
- 'post_type' => wc_get_order_types(),
1396
- 'post_status' => $purchase_history_status_list,
1397
- ) );
1398
  } else {
1399
- $customerOrders = get_posts( array(
1400
- 'numberposts' => -1,
1401
- 'meta_key' => '_customer_user',
1402
- 'meta_value' => $user,
1403
- 'post_type' => wc_get_order_types(),
1404
- 'post_status' => $purchase_history_status_list,
1405
- ) );
1406
- }
1407
- $totalPurchasedAmount = $totalOrder = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1408
  if(!empty($customerOrders)){
1409
  foreach ($customerOrders as $customerOrder) {
1410
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1411
  $total = FlycartWoocommerceOrder::get_total($order);
1412
- if($index == 'customer_based_on_purchase_history_product_order_count' && isset($rule['purchase_history_products'])){
1413
  $products = $this->getProductsFromRule($rule['purchase_history_products']);
1414
  $product_ids = FlycartWoocommerceOrder::get_product_ids($order);
1415
  if(!empty($products)){
@@ -1417,6 +1481,14 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1417
  continue;
1418
  }
1419
  }
 
 
 
 
 
 
 
 
1420
  }
1421
  $totalPurchasedAmount += $total;
1422
  $totalOrder++;
@@ -1427,6 +1499,9 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1427
  if($index == 'customer_based_on_purchase_history_order_count' || $index == 'customer_based_on_purchase_history_product_order_count'){
1428
  $totalAmount = $totalOrder;
1429
  }
 
 
 
1430
  $purchased_history_type = isset($rule['purchased_history_type'])? $rule['purchased_history_type']: 'atleast';
1431
  if($purchased_history_type == 'less_than_or_equal'){
1432
  if($totalAmount <= $rule['purchased_history_amount']){
@@ -1458,41 +1533,270 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1458
  if(!is_array($productInArray)){
1459
  $productInArray = array();
1460
  }
 
 
 
 
1461
  return $productInArray;
1462
  }
1463
 
1464
  /**
1465
- * verify the cart items are from selected category
 
 
 
 
1466
  * */
1467
- protected function validateCartItemsInSelectedCategory($index, $rule, $rules, $check_child_category = 0){
1468
- if($check_child_category){
1469
- $rule = FlycartWooDiscountRulesGeneralHelper::getAllSubCategories($rule);
 
 
 
 
 
 
 
1470
  }
1471
- $ruleSuccess = 0;
 
 
 
 
 
 
 
 
 
 
 
1472
  global $woocommerce;
1473
- $categoryFound = $sub_total = $quantity = $item_count = 0;
1474
- if(count($woocommerce->cart->cart_contents)){
1475
- foreach ($woocommerce->cart->cart_contents as $key => $cartItem) {
1476
- $categories = FlycartWoocommerceProduct::get_category_ids($cartItem['data']);
1477
- $categoryMatches = 0;
1478
- if(!empty($categories)){
1479
- foreach ($categories as $cat_id){
1480
- if(in_array($cat_id, $rule)){
1481
- $categoryMatches = 1;
1482
- $categoryFound = 1;
1483
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1484
  }
1485
  }
 
 
 
 
 
 
 
 
1486
  }
 
 
1487
 
1488
- if($categoryMatches){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1489
  $sub_total += $cartItem['line_subtotal'];//+$cartItem['line_subtotal_tax'];
1490
  $quantity += $cartItem['quantity'];
1491
  $item_count++;
1492
  }
1493
  }
1494
  }
1495
- if($categoryFound){
 
1496
  $ruleSuccess = 1;
1497
  if(is_array($rules) && count($rules)){
1498
  foreach ($rules as $rule_type => $rule_values){
@@ -1528,25 +1832,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1528
  }
1529
  }
1530
  }
1531
-
1532
- return $ruleSuccess;
1533
- }
1534
-
1535
- /**
1536
- * verify the cart items are from each selected category
1537
- * */
1538
- protected function validateCartItemsInEachSelectedCategory($index, $rule, $rules){
1539
- $ruleSuccess = 0;
1540
- if(is_array($rule)){
1541
- foreach ($rule as $category){
1542
- $category_matched = $this->validateCartItemsInSelectedCategory($index, array($category), $rules);
1543
- if($category_matched) $ruleSuccess = 1;
1544
- else {
1545
- $ruleSuccess = 0;
1546
- break;
1547
- }
1548
- }
1549
- }
1550
 
1551
  return $ruleSuccess;
1552
  }
@@ -1605,15 +1891,36 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1605
 
1606
  }
1607
 
1608
- public function calculate_conditional_subtotal($conditions) {
1609
-
1610
  $cart_subtotal = 0;
1611
  // Iterate over all cart items and
1612
  if(is_array($this->cart_items) && count($this->cart_items)){
1613
  foreach ($this->cart_items as $cart_item_key => $cart_item) {
 
 
 
 
 
 
 
 
 
1614
 
1615
- if($this->does_item_belong_to_category($conditions, $cart_item['data'])) {
 
 
 
 
 
 
 
 
 
 
 
 
1616
 
 
1617
  //total should be specific to the products from certan categories
1618
  $quantity = (isset($cart_item['quantity']) && $cart_item['quantity']) ? $cart_item['quantity'] : 1;
1619
  $cart_subtotal += FlycartWoocommerceProduct::get_price($cart_item['data'], true) * $quantity;
@@ -1756,14 +2063,16 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1756
  * @return bool
1757
  */
1758
  function validateBOGOCart($conditions,$rule_set){
 
1759
  $this->calculateCartSubtotal();
1760
  $rules = (is_string($conditions) ? json_decode($conditions, true) : array());
1761
  // Simple array helper to re-arrange the structure.
 
1762
  FlycartWooDiscountRulesGeneralHelper::reArrangeArray($rules);
1763
  if(is_array($rules) && count($rules)){
1764
  foreach ($rules as $index => $rule) {
1765
  // Validating the Rules one by one.
1766
- if ($this->applyCartBOGORule($index, $rule, $rules,$rule_set) == false) {
1767
  return false;
1768
  }
1769
  }
@@ -1779,7 +2088,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1779
  * @param $rule_set
1780
  * @return bool
1781
  */
1782
- function applyCartBOGORule($index, $rule, $rules,$rule_set){
1783
  //Calculating subtotal, quantity for BOGO Products
1784
  $cart = array();
1785
  $free_line_item = 0;
@@ -1812,7 +2121,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
1812
  $cart_subtotal_except_free = array_sum(array_column($cart,'subtotal')) - $free_item_price;
1813
  $cart_line_item_except_free = (count($cart)-$free_line_item);
1814
 
1815
- $skipRuleType = array('categories_in', 'in_each_category', 'atleast_one_including_sub_categories');
1816
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
1817
  switch ($index) {
1818
  // Cart Subtotal.
@@ -2128,27 +2437,14 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2128
  }
2129
  return false;
2130
  break;
 
 
 
2131
  case 'categories_in':
2132
- if(count($rule)){
2133
- $ruleSuccess = $this->validateCartItemsInSelectedCategory($index, $rule, $rules);
2134
- if($ruleSuccess){
2135
- return true;
2136
- }
2137
- }
2138
- return false;
2139
- break;
2140
  case 'atleast_one_including_sub_categories':
2141
- if(count($rule)){
2142
- $ruleSuccess = $this->validateCartItemsInSelectedCategory($index, $rule, $rules, 1);
2143
- if($ruleSuccess){
2144
- return true;
2145
- }
2146
- }
2147
- return false;
2148
- break;
2149
  case 'in_each_category':
2150
  if(count($rule)){
2151
- $ruleSuccess = $this->validateCartItemsInEachSelectedCategory($index, $rule, $rules);
2152
  if($ruleSuccess){
2153
  return true;
2154
  }
@@ -2158,6 +2454,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
2158
  case 'customer_based_on_purchase_history':
2159
  case 'customer_based_on_purchase_history_order_count':
2160
  case 'customer_based_on_purchase_history_product_order_count':
 
2161
  if(count($rule)){
2162
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
2163
  if($ruleSuccess){
50
  public $discount_total = 0;
51
  public $product_discount_total = 0;
52
 
53
+ public $has_category_in_rule = false;
54
+ public $has_product_specific_rule = false;
55
 
56
  /**
57
  * @var array
79
  public $bogo_coupon_codes = array();
80
  public static $applied_coupon = array();
81
 
82
+ protected $checked_for_categories_and_product_match = false;
83
+ protected $categories_and_product_match_value = false;
84
+
85
  /**
86
  * FlycartWooDiscountRulesCartRules constructor.
87
  */
181
  $request['discount_rule'][$index] = FlycartWooDiscountRulesGeneralHelper::makeString($value);
182
  }
183
 
184
+ $product_keys = array('products_in_list','products_not_in_list');
185
+ foreach ($request['discount_rule'] as $index => $value) {
186
+ foreach ($product_keys as $product_key){
187
+ if(isset($value[$product_key]) && !empty($value[$product_key])){
188
+ if(is_array($value[$product_key])){
189
+ $request['discount_rule'][$index]['product_variants'] = FlycartWooDiscountRulesPricingRules::getVariantsOfProducts($value[$product_key]);
190
+ }
191
+ }
192
+ }
193
+ }
194
+
195
  if (isset($request['discount_rule'])) $request['discount_rule'] = json_encode($request['discount_rule']);
196
 
197
  if (is_null($id) || !isset($id)) return false;
746
  }
747
  } else {
748
  //we will have to re-calculate the sub-total if it has category selected
749
+ $this->has_category_in_rule = $this->is_category_specific($rule);
750
+ $this->has_product_specific_rule = $this->is_product_specific($rule);
751
+ if($this->has_category_in_rule || $this->has_product_specific_rule) {
752
  if(!empty($this->cart_items)){
753
  if(!did_action('woocommerce_before_calculate_totals')){
754
  do_action('woocommerce_before_calculate_totals', FlycartWoocommerceCart::get_cart_object());
755
  }
756
  }
 
757
  //re-calculate the sub-total
758
+ $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule), $rule);
759
  } else {
760
  $subtotal = $this->sub_total;
761
  }
789
  }
790
  } else {
791
  //we will have to re-calculate the sub-total if it has category selected
792
+ $this->has_category_in_rule = $this->is_category_specific($rule);
793
+ $this->has_product_specific_rule = $this->is_product_specific($rule);
794
+ if($this->has_category_in_rule || $this->has_product_specific_rule) {
795
  //re-calculate the sub-total
796
+ $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule), $rule);
797
  }else {
798
  $subtotal = $this->sub_total;
799
  }
828
  }
829
  } else {
830
  //we will have to re-calculate the sub-total if it has category selected
831
+ $this->has_category_in_rule = $this->is_category_specific($rule);
832
+ $this->has_product_specific_rule = $this->is_product_specific($rule);
833
+ if($this->has_category_in_rule || $this->has_product_specific_rule) {
834
  //re-calculate the sub-total
835
+ $subtotal = $this->calculate_conditional_subtotal($this->get_discounted_categories_from_json($rule), $rule);
836
  }else {
837
  $subtotal = $this->sub_total;
838
  }
869
  return false;
870
  }
871
 
872
+ /**
873
+ * Check has product specific
874
+ * */
875
+ public function is_product_specific($rule) {
876
+ $result = false;
877
+ if ( ! empty( $rule['discount_rule'] ) )
878
+ {
879
+ if(!is_object($rule['discount_rule'])) {
880
+ //assume it is a json string and parse
881
+ $rules = json_decode($rule['discount_rule'], true);
882
+ }
883
+ if(count($rules)) {
884
+ foreach($rules as $rule) {
885
+ if(array_key_exists('products_in_list', $rule)) {
886
+ $result = true;
887
+ break;
888
+ }
889
+ if(array_key_exists('products_not_in_list', $rule)) {
890
+ $result = true;
891
+ break;
892
+ }
893
+ if(array_key_exists('exclude_sale_products', $rule)) {
894
+ $result = true;
895
+ break;
896
+ }
897
+ }
898
+ }
899
+ }
900
+
901
+ return $result;
902
+ }
903
+
904
  /**
905
  * get discount categories from rule
906
  * */
943
  */
944
  public function validateCart($rules)
945
  {
946
+ $this->checked_for_categories_and_product_match = false;
947
  $this->calculateCartSubtotal();
948
  $rules = (is_string($rules) ? json_decode($rules, true) : array());
949
+ $rules_with_all_data = $rules;
950
  // Simple array helper to re-arrange the structure.
951
  FlycartWooDiscountRulesGeneralHelper::reArrangeArray($rules);
952
  if(is_array($rules) && count($rules)){
953
  foreach ($rules as $index => $rule) {
954
  // Validating the Rules one by one.
955
+ if ($this->applyRule($index, $rule, $rules, $rules_with_all_data) == false) {
956
  return false;
957
  }
958
  }
967
  * @param array $rule array of rule info.
968
  * @return bool true|false as matched or not.
969
  */
970
+ public function applyRule($index, $rule, $rules, $rules_with_all_data)
971
  {
972
+ $skipRuleType = array('categories_in', 'in_each_category', 'atleast_one_including_sub_categories', 'products_in_list', 'products_not_in_list', 'exclude_sale_products');
973
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
974
  switch ($index) {
975
 
1286
  }
1287
  return false;
1288
  break;
1289
+ case 'products_in_list':
1290
+ case 'products_not_in_list':
1291
+ case 'exclude_sale_products':
1292
  case 'categories_in':
 
 
 
 
 
 
 
 
1293
  case 'atleast_one_including_sub_categories':
 
 
 
 
 
 
 
 
1294
  case 'in_each_category':
1295
  if(count($rule)){
1296
+ $ruleSuccess = $this->validateCartItemsInSelectedProductsAndCategories($index, $rule, $rules, $rules_with_all_data);
1297
  if($ruleSuccess){
1298
  return true;
1299
  }
1303
  case 'customer_based_on_purchase_history':
1304
  case 'customer_based_on_purchase_history_order_count':
1305
  case 'customer_based_on_purchase_history_product_order_count':
1306
+ case 'customer_based_on_purchase_history_product_quantity_count':
1307
  if(count($rule)){
1308
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
1309
  if($ruleSuccess){
1427
  $purchase_history_status_list = isset($rule['purchase_history_order_status'])? $rule['purchase_history_order_status']: array('wc-completed');
1428
  if(isset($rule['purchased_history_amount'])){
1429
  if($rule['purchased_history_amount'] >= 0){
1430
+ $purchased_history_duration = isset($rule['purchased_history_duration'])? $rule['purchased_history_duration']: 'all_time';
1431
+ $purchased_history_duration_days = isset($rule['purchased_history_duration_days'])? $rule['purchased_history_duration_days']: '';
1432
+ $query = array(
1433
+ 'numberposts' => -1,
1434
+ 'meta_value' => $email,
1435
+ 'post_type' => wc_get_order_types(),
1436
+ 'post_status' => $purchase_history_status_list,
1437
+ );
1438
  if(!empty($email)){
1439
+ $query['meta_key'] = '_billing_email';
 
 
 
 
 
 
1440
  } else {
1441
+ $query['meta_key'] = '_customer_user';
1442
+ }
1443
+
1444
+ if($purchased_history_duration != 'all_time'){
1445
+ $days = false;
1446
+ if(in_array($purchased_history_duration, array('7_days', '14_days', '30_days', '60_days', '90_days', '180_days'))){
1447
+ $split_days = explode('_', $purchased_history_duration);
1448
+ if(isset($split_days['0'])){
1449
+ if(((int)$split_days['0']) > 0){
1450
+ $days = '- '.(int)$split_days['0'].' days';
1451
+ }
1452
+ }
1453
+
1454
+ } else if($purchased_history_duration == '1_year'){
1455
+ $days = '- 1 years';
1456
+ } else if($purchased_history_duration == 'custom_days'){
1457
+ if($purchased_history_duration_days > 0 ){
1458
+ $purchased_history_duration_days = (int)$purchased_history_duration_days;
1459
+ $days = '- '.$purchased_history_duration_days.' days';
1460
+ }
1461
+ }
1462
+ if($days !== false){
1463
+ $query['date_query'] = array(
1464
+ 'column' => 'post_date',
1465
+ 'after' => $days
1466
+ );
1467
+ }
1468
+ }
1469
+
1470
+ $customerOrders = get_posts( $query );
1471
+ $totalPurchasedAmount = $totalOrder = $totalQuantityPurchased = 0;
1472
  if(!empty($customerOrders)){
1473
  foreach ($customerOrders as $customerOrder) {
1474
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1475
  $total = FlycartWoocommerceOrder::get_total($order);
1476
+ if(($index == 'customer_based_on_purchase_history_product_order_count' || $index == 'customer_based_on_purchase_history_product_quantity_count') && isset($rule['purchase_history_products'])){
1477
  $products = $this->getProductsFromRule($rule['purchase_history_products']);
1478
  $product_ids = FlycartWoocommerceOrder::get_product_ids($order);
1479
  if(!empty($products)){
1481
  continue;
1482
  }
1483
  }
1484
+ $product_quantities = FlycartWoocommerceOrder::get_product_quantities($order);
1485
+ if(!empty($product_quantities) && !empty($products)){
1486
+ foreach ($products as $product_id){
1487
+ if(isset($product_quantities[$product_id])){
1488
+ $totalQuantityPurchased += $product_quantities[$product_id];
1489
+ }
1490
+ }
1491
+ }
1492
  }
1493
  $totalPurchasedAmount += $total;
1494
  $totalOrder++;
1499
  if($index == 'customer_based_on_purchase_history_order_count' || $index == 'customer_based_on_purchase_history_product_order_count'){
1500
  $totalAmount = $totalOrder;
1501
  }
1502
+ if($index == 'customer_based_on_purchase_history_product_quantity_count'){
1503
+ $totalAmount = $totalQuantityPurchased;
1504
+ }
1505
  $purchased_history_type = isset($rule['purchased_history_type'])? $rule['purchased_history_type']: 'atleast';
1506
  if($purchased_history_type == 'less_than_or_equal'){
1507
  if($totalAmount <= $rule['purchased_history_amount']){
1533
  if(!is_array($productInArray)){
1534
  $productInArray = array();
1535
  }
1536
+
1537
+ $variants = null;
1538
+ $productInArray = apply_filters('woo_discount_rule_products_to_include', $productInArray, array(), $variants);
1539
+
1540
  return $productInArray;
1541
  }
1542
 
1543
  /**
1544
+ * Check product category matches
1545
+ *
1546
+ * @param $product object
1547
+ * @param $categories array
1548
+ * @return boolean
1549
  * */
1550
+ protected function checkCategoryMatches($product, $categories){
1551
+ $result = false;
1552
+ $product_categories = FlycartWoocommerceProduct::get_category_ids($product);
1553
+ if(!empty($product_categories)){
1554
+ foreach ($product_categories as $cat_id){
1555
+ if(in_array($cat_id, $categories)){
1556
+ $result = true;
1557
+ break;
1558
+ }
1559
+ }
1560
  }
1561
+
1562
+ return $result;
1563
+ }
1564
+
1565
+ /**
1566
+ * Check category found in cart
1567
+ *
1568
+ * @param $product object
1569
+ * @param $categories array
1570
+ * @return boolean
1571
+ * */
1572
+ protected function checkAllCategoryFoundInCart($product, $categories){
1573
  global $woocommerce;
1574
+ $all_product_categories = array();
1575
+ $result = false;
1576
+ foreach ($woocommerce->cart->cart_contents as $key => $cartItem) {
1577
+ $product_categories = FlycartWoocommerceProduct::get_category_ids($cartItem['data']);
1578
+ if(!empty($product_categories)){
1579
+ if(is_array($product_categories)){
1580
+ $all_product_categories = array_merge($all_product_categories, $product_categories);
1581
+ }
1582
+ }
1583
+ }
1584
+ if(!empty($all_product_categories)){
1585
+ $all_product_categories = array_unique($all_product_categories);
1586
+ $intersect_categories = array_intersect($categories, $all_product_categories);
1587
+ }
1588
+
1589
+ if(!empty($intersect_categories)) {
1590
+ if (count($intersect_categories) == count($categories)) {
1591
+ $result = true;
1592
+ }
1593
+ }
1594
+
1595
+ return $result;
1596
+ }
1597
+
1598
+ /**
1599
+ * Check product matches
1600
+ *
1601
+ * @param $product object
1602
+ * @param $products array
1603
+ * @return boolean
1604
+ * */
1605
+ protected function checkProductMatches($product, $products){
1606
+ $result = false;
1607
+ $product_id = FlycartWoocommerceProduct::get_id($product);
1608
+ if(in_array($product_id, $products)){
1609
+ $result = true;
1610
+ }
1611
+
1612
+ return $result;
1613
+ }
1614
+
1615
+ /**
1616
+ * Get variants of selected products
1617
+ *
1618
+ * @param $discount_type string
1619
+ * @param $rules_with_all_data array
1620
+ * @return array
1621
+ * */
1622
+ protected function getVariantsOfSelectedProduct($discount_type, $rules_with_all_data){
1623
+ if(!empty($rules_with_all_data)){
1624
+ foreach ($rules_with_all_data as $rule){
1625
+ if(isset($rule[$discount_type]) && isset($rule['product_variants'])){
1626
+ if(!empty($rule['product_variants'])){
1627
+ return $rule['product_variants'];
1628
+ }
1629
+ }
1630
+ }
1631
+ }
1632
+
1633
+ return array();
1634
+ }
1635
+
1636
+ /**
1637
+ * Check Product matches for a product
1638
+ *
1639
+ * @param $product object
1640
+ * @param $rules array
1641
+ * @param $rules_with_all_data array
1642
+ * @return boolean
1643
+ * */
1644
+ protected function checkForProductConditionsMatchesForAnProduct($product, $rules, $rules_with_all_data){
1645
+ $allow_discount = true;
1646
+ $config = FlycartWooDiscountBase::get_instance();
1647
+ $include_variants_on_select_parent_product = $config->getConfigData('include_variants_on_select_parent_product', 0);
1648
+ if($allow_discount){
1649
+ //check for product in list
1650
+ if(isset($rules['products_in_list'])){
1651
+ if(!empty($rules['products_in_list']) && is_array($rules['products_in_list'])){
1652
+ $product_ids = $rules['products_in_list'];
1653
+ if($include_variants_on_select_parent_product){
1654
+ $variant_ids = $this->getVariantsOfSelectedProduct('products_in_list', $rules_with_all_data);
1655
+ if(!empty($variant_ids)){
1656
+ $product_ids = array_merge($product_ids, $variant_ids);
1657
+ $product_ids = array_unique($product_ids);
1658
  }
1659
  }
1660
+ if(!empty($product_ids)){
1661
+ $matched = $this->checkProductMatches($product, $product_ids);
1662
+ if(!$matched){
1663
+ $allow_discount = false;
1664
+ }
1665
+ }
1666
+ } else {
1667
+ $allow_discount = false;
1668
  }
1669
+ }
1670
+ }
1671
 
1672
+ if($allow_discount){
1673
+ //check for product not in list
1674
+ if(isset($rules['products_not_in_list'])){
1675
+ if(!empty($rules['products_not_in_list']) && is_array($rules['products_not_in_list'])){
1676
+ $product_ids = $rules['products_not_in_list'];
1677
+ if($include_variants_on_select_parent_product){
1678
+ $variant_ids = $this->getVariantsOfSelectedProduct('products_not_in_list', $rules_with_all_data);
1679
+ if(!empty($variant_ids)){
1680
+ $product_ids = array_merge($product_ids, $variant_ids);
1681
+ $product_ids = array_unique($product_ids);
1682
+ }
1683
+ }
1684
+ if(!empty($product_ids)){
1685
+ $matched = $this->checkProductMatches($product, $product_ids);
1686
+ if($matched){
1687
+ $allow_discount = false;
1688
+ }
1689
+ }
1690
+ }
1691
+ }
1692
+ }
1693
+ if($allow_discount){
1694
+ //check for exclude products which are in sale
1695
+ if(isset($rules['exclude_sale_products'])){
1696
+ $product_id = FlycartWoocommerceProduct::get_id($product);
1697
+ $original_product = FlycartWoocommerceProduct::wc_get_product($product_id);
1698
+ $is_on_sale = FlycartWoocommerceProduct::is_product_is_on_sale($original_product);
1699
+ if($is_on_sale){
1700
+ $allow_discount = false;
1701
+ }
1702
+ }
1703
+ }
1704
+
1705
+ return $allow_discount;
1706
+ }
1707
+
1708
+ /**
1709
+ * Check for Category and product conditions matches for the product
1710
+ *
1711
+ * @param $product object
1712
+ * @param $rules array
1713
+ * @param $rules_with_all_data array
1714
+ * @return boolean
1715
+ * */
1716
+ protected function checkForCategoryAndProductMatchesForAnProduct($product, $rules, $rules_with_all_data){
1717
+ $allow_discount = true;
1718
+ if(isset($rules['categories_in'])){
1719
+ if(!empty($rules['categories_in']) && is_array($rules['categories_in'])){
1720
+ $matched = $this->checkCategoryMatches($product, $rules['categories_in']);
1721
+ if(!$matched){
1722
+ $allow_discount = false;
1723
+ }
1724
+ } else {
1725
+ $allow_discount = false;
1726
+ }
1727
+ }
1728
+
1729
+ if($allow_discount){
1730
+ if(isset($rules['atleast_one_including_sub_categories'])){
1731
+ if(!empty($rules['atleast_one_including_sub_categories']) && is_array($rules['atleast_one_including_sub_categories'])){
1732
+ $categories = FlycartWooDiscountRulesGeneralHelper::getAllSubCategories($rules['atleast_one_including_sub_categories']);
1733
+ $matched = $this->checkCategoryMatches($product, $categories);
1734
+ if(!$matched){
1735
+ $allow_discount = false;
1736
+ }
1737
+ } else {
1738
+ $allow_discount = false;
1739
+ }
1740
+ }
1741
+ }
1742
+
1743
+ if($allow_discount){
1744
+ if(isset($rules['in_each_category'])){
1745
+ if(!empty($rules['in_each_category']) && is_array($rules['in_each_category'])){
1746
+ $has_found_each_category = $this->checkAllCategoryFoundInCart($product, $rules['in_each_category']);
1747
+ if($has_found_each_category){
1748
+ $found_at_least_one = false;
1749
+ foreach ($rules['in_each_category'] as $category){
1750
+ $matched = $this->checkCategoryMatches($product, array($category));
1751
+ if($matched){
1752
+ $found_at_least_one = true;
1753
+ break;
1754
+ }
1755
+ }
1756
+ if($found_at_least_one){
1757
+ $allow_discount = true;
1758
+ } else {
1759
+ $allow_discount = false;
1760
+ }
1761
+ } else {
1762
+ $allow_discount = false;
1763
+ }
1764
+ } else {
1765
+ $allow_discount = false;
1766
+ }
1767
+ }
1768
+ }
1769
+
1770
+ if($allow_discount){
1771
+ $allow_discount = $this->checkForProductConditionsMatchesForAnProduct($product, $rules, $rules_with_all_data);
1772
+ }
1773
+
1774
+ return $allow_discount;
1775
+ }
1776
+
1777
+ /**
1778
+ * verify the cart items are from selected category
1779
+ * */
1780
+ protected function validateCartItemsInSelectedProductsAndCategories($index, $rule, $rules, $rules_with_all_data){
1781
+ if($this->checked_for_categories_and_product_match){
1782
+ return $this->categories_and_product_match_value;
1783
+ }
1784
+ $ruleSuccess = 0;
1785
+ global $woocommerce;
1786
+ $allow_discount = $sub_total = $quantity = $item_count = 0;
1787
+ if(count($woocommerce->cart->cart_contents)){
1788
+ foreach ($woocommerce->cart->cart_contents as $key => $cartItem) {
1789
+ $matches = $this->checkForCategoryAndProductMatchesForAnProduct($cartItem['data'], $rules, $rules_with_all_data);
1790
+ if($matches){
1791
+ $allow_discount = 1;
1792
  $sub_total += $cartItem['line_subtotal'];//+$cartItem['line_subtotal_tax'];
1793
  $quantity += $cartItem['quantity'];
1794
  $item_count++;
1795
  }
1796
  }
1797
  }
1798
+
1799
+ if($allow_discount){
1800
  $ruleSuccess = 1;
1801
  if(is_array($rules) && count($rules)){
1802
  foreach ($rules as $rule_type => $rule_values){
1832
  }
1833
  }
1834
  }
1835
+ $this->categories_and_product_match_value = $ruleSuccess;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1836
 
1837
  return $ruleSuccess;
1838
  }
1891
 
1892
  }
1893
 
1894
+ public function calculate_conditional_subtotal($conditions, $rule) {
 
1895
  $cart_subtotal = 0;
1896
  // Iterate over all cart items and
1897
  if(is_array($this->cart_items) && count($this->cart_items)){
1898
  foreach ($this->cart_items as $cart_item_key => $cart_item) {
1899
+ $apply_discount = false;
1900
+ if($this->has_category_in_rule){
1901
+ if($this->does_item_belong_to_category($conditions, $cart_item['data'])) {
1902
+ $apply_discount = true;
1903
+ }
1904
+ }
1905
+
1906
+ if($this->has_product_specific_rule){
1907
+ $discount_condition = json_decode($rule['discount_rule'], true);
1908
 
1909
+ if(!empty($discount_condition) && is_array($discount_condition)){
1910
+ $rules = $discount_condition;
1911
+ FlycartWooDiscountRulesGeneralHelper::reArrangeArray($rules);
1912
+ $apply_discount_result = $this->checkForProductConditionsMatchesForAnProduct($cart_item['data'], $rules, $discount_condition);
1913
+ if($this->has_category_in_rule){
1914
+ if($apply_discount){
1915
+ $apply_discount = $apply_discount_result;
1916
+ }
1917
+ } else {
1918
+ $apply_discount = $apply_discount_result;
1919
+ }
1920
+ }
1921
+ }
1922
 
1923
+ if($apply_discount) {
1924
  //total should be specific to the products from certan categories
1925
  $quantity = (isset($cart_item['quantity']) && $cart_item['quantity']) ? $cart_item['quantity'] : 1;
1926
  $cart_subtotal += FlycartWoocommerceProduct::get_price($cart_item['data'], true) * $quantity;
2063
  * @return bool
2064
  */
2065
  function validateBOGOCart($conditions,$rule_set){
2066
+ $this->checked_for_categories_and_product_match = false;
2067
  $this->calculateCartSubtotal();
2068
  $rules = (is_string($conditions) ? json_decode($conditions, true) : array());
2069
  // Simple array helper to re-arrange the structure.
2070
+ $rules_with_all_data = $rules;
2071
  FlycartWooDiscountRulesGeneralHelper::reArrangeArray($rules);
2072
  if(is_array($rules) && count($rules)){
2073
  foreach ($rules as $index => $rule) {
2074
  // Validating the Rules one by one.
2075
+ if ($this->applyCartBOGORule($index, $rule, $rules,$rule_set, $rules_with_all_data) == false) {
2076
  return false;
2077
  }
2078
  }
2088
  * @param $rule_set
2089
  * @return bool
2090
  */
2091
+ function applyCartBOGORule($index, $rule, $rules,$rule_set, $rules_with_all_data){
2092
  //Calculating subtotal, quantity for BOGO Products
2093
  $cart = array();
2094
  $free_line_item = 0;
2121
  $cart_subtotal_except_free = array_sum(array_column($cart,'subtotal')) - $free_item_price;
2122
  $cart_line_item_except_free = (count($cart)-$free_line_item);
2123
 
2124
+ $skipRuleType = array('categories_in', 'in_each_category', 'atleast_one_including_sub_categories', 'products_in_list', 'products_not_in_list', 'exclude_sale_products');
2125
  $availableRuleToSkip = array_intersect($skipRuleType, array_keys($rules));
2126
  switch ($index) {
2127
  // Cart Subtotal.
2437
  }
2438
  return false;
2439
  break;
2440
+ case 'products_in_list':
2441
+ case 'products_not_in_list':
2442
+ case 'exclude_sale_products':
2443
  case 'categories_in':
 
 
 
 
 
 
 
 
2444
  case 'atleast_one_including_sub_categories':
 
 
 
 
 
 
 
 
2445
  case 'in_each_category':
2446
  if(count($rule)){
2447
+ $ruleSuccess = $this->validateCartItemsInSelectedProductsAndCategories($index, $rule, $rules, $rules_with_all_data);
2448
  if($ruleSuccess){
2449
  return true;
2450
  }
2454
  case 'customer_based_on_purchase_history':
2455
  case 'customer_based_on_purchase_history_order_count':
2456
  case 'customer_based_on_purchase_history_product_order_count':
2457
+ case 'customer_based_on_purchase_history_product_quantity_count':
2458
  if(count($rule)){
2459
  $ruleSuccess = $this->validateCartItemsBasedOnPurchaseHistory($index, $rule, $rules);
2460
  if($ruleSuccess){
includes/discount-base.php CHANGED
@@ -109,10 +109,11 @@ if (!class_exists('FlycartWooDiscountBase')) {
109
  if(!empty($additional_class) && is_string($additional_class)){
110
  $additional_class_to_add = $additional_class;
111
  }
 
112
  $script = '<script type="text/javascript">
113
  jQuery( function( $ ) {
114
  $(document).ready(function() {
115
- $( document.body ).on( "blur", "input#billing_email, select#billing_state'.$additional_class_to_add.'", function() {
116
  $("select#billing_country").trigger("change");
117
  });
118
  });
@@ -409,6 +410,7 @@ if (!class_exists('FlycartWooDiscountBase')) {
409
  }
410
  }
411
  }
 
412
  return $discount_list;
413
 
414
  }
@@ -432,12 +434,16 @@ if (!class_exists('FlycartWooDiscountBase')) {
432
  'coupon_applied_any_one' => 'coupon_to_apply',
433
  'coupon_applied_all_selected' => 'coupon_to_apply',
434
 
 
 
 
435
  'users_in' => 'users_to_apply',
436
  'roles_in' => 'user_roles_to_apply',
437
  'shipping_countries_in' => 'countries_to_apply',
438
- 'customer_based_on_purchase_history' => array('purchase_history_order_status', 'purchased_history_amount', 'purchased_history_type'),
439
- 'customer_based_on_purchase_history_order_count' => array('purchase_history_order_status', 'purchased_history_amount', 'purchased_history_type'),
440
- 'customer_based_on_purchase_history_product_order_count' => array('purchase_history_order_status', 'purchased_history_amount', 'purchased_history_type', 'purchase_history_products'),
 
441
  );
442
  }
443
 
@@ -1072,6 +1078,7 @@ if (!class_exists('FlycartWooDiscountBase')) {
1072
  'purchased_amount' => esc_html__('Purchased amount', 'woo-discount-rules'),
1073
  'number_of_order_purchased' => esc_html__('Number of previous orders made', 'woo-discount-rules'),
1074
  'number_of_order_purchased_in_product' => esc_html__('Number of previous orders made with following products', 'woo-discount-rules'),
 
1075
  'coupon_applied' => esc_html__('Coupon applied', 'woo-discount-rules'),
1076
  'atleast_any_one' => esc_html__('Atleast any one', 'woo-discount-rules'),
1077
  'all_selected_coupon' => esc_html__('All selected', 'woo-discount-rules'),
@@ -1094,6 +1101,21 @@ if (!class_exists('FlycartWooDiscountBase')) {
1094
  'percentage_discount_amount_tool_tip_text' => esc_attr__('Enter only numeric values. Eg: <b>50</b> for 50% discount', 'woo-discount-rules'),
1095
  'price_discount_amount_tool_tip_text' => sprintf(esc_attr__('Enter the discount price. Eg: <b>10</b> for %s discount', 'woo-discount-rules'), strip_tags(FlycartWoocommerceProduct::wc_price(10))),
1096
  'discount_product_option_tooltip' => esc_html__("Auto add all selected products - Automatically added to the cart <br> Same product - get discount in same product <br> Any one cheapest from selected - Get discount in one selected product <br> Any one cheapest from all products - Get discount in one cheapest product in cart <br> Cheapest in cart - selected category(ies) - cheapest product from the selected category will be discounted <br> Cheapest in cart - selected item(s) - get discount in chosen no.of quantities", 'woo-discount-rules'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1097
  );
1098
  }
1099
 
109
  if(!empty($additional_class) && is_string($additional_class)){
110
  $additional_class_to_add = $additional_class;
111
  }
112
+ $on_blur_event_for_items = apply_filters('woo_discount_rules_class_to_refresh_the_checkout_review_on_blur', 'input#billing_email, select#billing_state');
113
  $script = '<script type="text/javascript">
114
  jQuery( function( $ ) {
115
  $(document).ready(function() {
116
+ $( document.body ).on( "blur", "'.$on_blur_event_for_items.$additional_class_to_add.'", function() {
117
  $("select#billing_country").trigger("change");
118
  });
119
  });
410
  }
411
  }
412
  }
413
+
414
  return $discount_list;
415
 
416
  }
434
  'coupon_applied_any_one' => 'coupon_to_apply',
435
  'coupon_applied_all_selected' => 'coupon_to_apply',
436
 
437
+ 'products_in_list' => 'products',
438
+ 'products_not_in_list' => 'products',
439
+
440
  'users_in' => 'users_to_apply',
441
  'roles_in' => 'user_roles_to_apply',
442
  'shipping_countries_in' => 'countries_to_apply',
443
+ 'customer_based_on_purchase_history' => array('purchase_history_order_status', 'purchased_history_amount', 'purchased_history_type', 'purchased_history_duration', 'purchased_history_duration_days'),
444
+ 'customer_based_on_purchase_history_order_count' => array('purchase_history_order_status', 'purchased_history_amount', 'purchased_history_type', 'purchased_history_duration', 'purchased_history_duration_days'),
445
+ 'customer_based_on_purchase_history_product_order_count' => array('purchase_history_order_status', 'purchased_history_amount', 'purchased_history_type', 'purchase_history_products', 'purchased_history_duration', 'purchased_history_duration_days'),
446
+ 'customer_based_on_purchase_history_product_quantity_count' => array('purchase_history_order_status', 'purchased_history_amount', 'purchased_history_type', 'purchase_history_products', 'purchased_history_duration', 'purchased_history_duration_days'),
447
  );
448
  }
449
 
1078
  'purchased_amount' => esc_html__('Purchased amount', 'woo-discount-rules'),
1079
  'number_of_order_purchased' => esc_html__('Number of previous orders made', 'woo-discount-rules'),
1080
  'number_of_order_purchased_in_product' => esc_html__('Number of previous orders made with following products', 'woo-discount-rules'),
1081
+ 'number_of_order_quantity_purchased_in_product' => esc_html__('Number of quantity(s) in previous orders made with following products', 'woo-discount-rules'),
1082
  'coupon_applied' => esc_html__('Coupon applied', 'woo-discount-rules'),
1083
  'atleast_any_one' => esc_html__('Atleast any one', 'woo-discount-rules'),
1084
  'all_selected_coupon' => esc_html__('All selected', 'woo-discount-rules'),
1101
  'percentage_discount_amount_tool_tip_text' => esc_attr__('Enter only numeric values. Eg: <b>50</b> for 50% discount', 'woo-discount-rules'),
1102
  'price_discount_amount_tool_tip_text' => sprintf(esc_attr__('Enter the discount price. Eg: <b>10</b> for %s discount', 'woo-discount-rules'), strip_tags(FlycartWoocommerceProduct::wc_price(10))),
1103
  'discount_product_option_tooltip' => esc_html__("Auto add all selected products - Automatically added to the cart <br> Same product - get discount in same product <br> Any one cheapest from selected - Get discount in one selected product <br> Any one cheapest from all products - Get discount in one cheapest product in cart <br> Cheapest in cart - selected category(ies) - cheapest product from the selected category will be discounted <br> Cheapest in cart - selected item(s) - get discount in chosen no.of quantities", 'woo-discount-rules'),
1104
+ 'products_in_cart' => esc_html__('Products', 'woo-discount-rules'),
1105
+ 'products_in_list' => esc_html__('Products in cart', 'woo-discount-rules'),
1106
+ 'products_not_in_list' => esc_html__('Exclude products', 'woo-discount-rules'),
1107
+ 'exclude_sale_products' => esc_html__('Exclude on sale products', 'woo-discount-rules'),
1108
+ 'exclude_sale_products_desc' => esc_html__('This will exclude the on sale products from discount', 'woo-discount-rules'),
1109
+ 'from_all_previous_orders' => esc_html__('From all previous orders', 'woo-discount-rules'),
1110
+ 'last_7_days' => esc_html__('Last 7 days', 'woo-discount-rules'),
1111
+ 'last_14_days' => esc_html__('Last 14 days', 'woo-discount-rules'),
1112
+ 'last_30_days' => esc_html__('Last 30 days', 'woo-discount-rules'),
1113
+ 'last_60_days' => esc_html__('Last 60 days', 'woo-discount-rules'),
1114
+ 'last_90_days' => esc_html__('Last 90 days', 'woo-discount-rules'),
1115
+ 'last_180_days' => esc_html__('Last 180 days', 'woo-discount-rules'),
1116
+ 'last_1_year' => esc_html__('Last 1 year', 'woo-discount-rules'),
1117
+ 'custom_days' => esc_html__('Custom', 'woo-discount-rules'),
1118
+ 'in_days' => esc_html__('in days', 'woo-discount-rules'),
1119
  );
1120
  }
1121
 
includes/pricing-rules.php CHANGED
@@ -262,6 +262,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
262
  $form[] = 'purchased_history_type';
263
  $form[] = 'purchase_history_status_list';
264
  $form[] = 'purchase_history_products';
 
 
265
  if (isset($request['purchase_history_status_list'])) $request['purchase_history_status_list'] = json_encode($request['purchase_history_status_list']);
266
  else $request['purchase_history_status_list'] = json_encode(array('wc-completed'));
267
  }
@@ -333,7 +335,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
333
  }
334
  $request[$variant_key] = array();
335
  if(!empty($products)){
336
- $request[$variant_key] = $this->getVariantsOfProducts($products);
337
  }
338
  }
339
  }
@@ -344,7 +346,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
344
  /**
345
  * Get variants of the products selected
346
  * */
347
- protected function getVariantsOfProducts($products){
348
  $variants = array();
349
  if(!empty($products)){
350
  foreach ($products as $product_id){
@@ -1108,30 +1110,52 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1108
  if($user || !empty($email)){
1109
  if(isset($rule->purchased_history_amount) && isset($rule->purchase_history_status_list)){
1110
  if($rule->purchased_history_amount >= 0){
 
 
1111
  $purchase_history_status_list = json_decode($rule->purchase_history_status_list, true);
 
 
 
 
 
 
1112
  if(!empty($email)){
1113
- $customerOrders = get_posts( array(
1114
- 'numberposts' => -1,
1115
- 'meta_key' => '_billing_email',
1116
- 'meta_value' => $email,
1117
- 'post_type' => wc_get_order_types(),
1118
- 'post_status' => $purchase_history_status_list,
1119
- ) );
1120
  } else {
1121
- $customerOrders = get_posts( array(
1122
- 'numberposts' => -1,
1123
- 'meta_key' => '_customer_user',
1124
- 'meta_value' => $user,
1125
- 'post_type' => wc_get_order_types(),
1126
- 'post_status' => $purchase_history_status_list,
1127
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1128
  }
1129
- $totalPurchasedAmount = $totalOrder = 0;
 
1130
  if(!empty($customerOrders)){
1131
  foreach ($customerOrders as $customerOrder) {
1132
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1133
  $total = FlycartWoocommerceOrder::get_total($order);
1134
- if($rule->based_on_purchase_history == 3){
1135
  $products = $this->getPurchasedProductsFromRule($rule);
1136
  $product_ids = FlycartWoocommerceOrder::get_product_ids($order);
1137
  if(!empty($products)){
@@ -1139,6 +1163,14 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1139
  continue;
1140
  }
1141
  }
 
 
 
 
 
 
 
 
1142
  }
1143
  $totalPurchasedAmount += $total;
1144
  $totalOrder++;
@@ -1148,6 +1180,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1148
  if($rule->based_on_purchase_history == 2 || $rule->based_on_purchase_history == 3){
1149
  $totalAmount = $totalOrder;
1150
  }
 
 
 
1151
  $purchased_history_type = isset($rule->purchased_history_type)? $rule->purchased_history_type: 'atleast';
1152
  if($purchased_history_type == 'less_than_or_equal'){
1153
  if($totalAmount <= $rule->purchased_history_amount){
@@ -2145,24 +2180,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2145
  public function isItemInSaleItems($rule_exclude_sale_items, $product)
2146
  {
2147
  if (!$rule_exclude_sale_items) return false;
2148
- $sale_price = FlycartWoocommerceProduct::get_sale_price($product);
2149
- if($sale_price > 0){
2150
- $on_sale = true;
2151
- if(method_exists($product, 'get_date_on_sale_from')){
2152
- if ( $product->get_date_on_sale_from() && $product->get_date_on_sale_from()->getTimestamp() > current_time( 'timestamp', true ) ) {
2153
- $on_sale = false;
2154
- }
2155
- }
2156
- if(method_exists($product, 'get_date_on_sale_to')){
2157
- if ( $product->get_date_on_sale_to() && $product->get_date_on_sale_to()->getTimestamp() < current_time( 'timestamp', true ) ) {
2158
- $on_sale = false;
2159
- }
2160
- }
2161
 
2162
- return $on_sale;
2163
- }
2164
-
2165
- return false;
2166
  }
2167
 
2168
  /**
@@ -2818,6 +2837,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2818
  if(!is_array($purchasedProduct)){
2819
  $purchasedProduct = array();
2820
  }
 
 
 
2821
  return $purchasedProduct;
2822
  }
2823
 
@@ -3642,9 +3664,9 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3642
  if (!$product->is_type($excluded_product_type)) {
3643
  $product_id = FlycartWoocommerceProduct::get_id($product);
3644
  // if(!empty(self::$product_on_sale_details[$product_id])){
3645
- $sale_price = FlycartWoocommerceProduct::get_price($product);
3646
  $regular_price = FlycartWoocommerceProduct::get_regular_price($product);
3647
- if($sale_price == $regular_price){
3648
  $item_price = '<span class="cart_price wdr_product_strikeout">';
3649
  $regular_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $regular_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $regular_price);
3650
  $price_to_display = FlycartWoocommerceProduct::wc_price($regular_price);
@@ -3796,6 +3818,21 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3796
  $return['status'] = 1;
3797
  $return['price_html'] = $price_html;
3798
  $return['product_type'] = $product->get_type();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3799
  }
3800
  echo json_encode($return);
3801
  exit;
@@ -3811,31 +3848,32 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3811
  protected function getOriginalStrikeoutPriceOfProduct($product){
3812
  $product_id = FlycartWoocommerceProduct::get_id($product);
3813
  $product_type = $product->get_type();
3814
- $sale_price = FlycartWoocommerceProduct::get_price($product);
3815
  $regular_price = FlycartWoocommerceProduct::get_regular_price($product);
3816
- if($sale_price == $regular_price){
 
 
3817
  $sale_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $sale_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $sale_price);
3818
- $html = '';
3819
  if($product_type == 'variation'){
3820
- $html = '<span class="price">';
3821
  }
3822
- $html .= FlycartWoocommerceProduct::wc_price($sale_price);
 
3823
  if($product_type == 'variation'){
3824
  $html .= '</span>';
3825
  }
 
3826
  } else {
3827
- $html = '<span class="cart_price wdr_product_strikeout">';
3828
- $regular_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $regular_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $regular_price);
3829
  $sale_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $sale_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $sale_price);
 
3830
  if($product_type == 'variation'){
3831
- $html .= '<span class="price">';
3832
  }
3833
- $html .= "<del>".FlycartWoocommerceProduct::wc_price($regular_price)."</del>";
3834
- $html .= "<ins>".FlycartWoocommerceProduct::wc_price($sale_price)."</ins>";
3835
  if($product_type == 'variation'){
3836
  $html .= '</span>';
3837
  }
3838
- $html .= '</span>';
3839
  }
3840
 
3841
  return $html;
262
  $form[] = 'purchased_history_type';
263
  $form[] = 'purchase_history_status_list';
264
  $form[] = 'purchase_history_products';
265
+ $form[] = 'purchased_history_duration';
266
+ $form[] = 'purchased_history_duration_days';
267
  if (isset($request['purchase_history_status_list'])) $request['purchase_history_status_list'] = json_encode($request['purchase_history_status_list']);
268
  else $request['purchase_history_status_list'] = json_encode(array('wc-completed'));
269
  }
335
  }
336
  $request[$variant_key] = array();
337
  if(!empty($products)){
338
+ $request[$variant_key] = self::getVariantsOfProducts($products);
339
  }
340
  }
341
  }
346
  /**
347
  * Get variants of the products selected
348
  * */
349
+ public static function getVariantsOfProducts($products){
350
  $variants = array();
351
  if(!empty($products)){
352
  foreach ($products as $product_id){
1110
  if($user || !empty($email)){
1111
  if(isset($rule->purchased_history_amount) && isset($rule->purchase_history_status_list)){
1112
  if($rule->purchased_history_amount >= 0){
1113
+ $purchased_history_duration = isset($rule->purchased_history_duration)? $rule->purchased_history_duration: 'all_time';
1114
+ $purchased_history_duration_days = isset($rule->purchased_history_duration_days)? $rule->purchased_history_duration_days: '';
1115
  $purchase_history_status_list = json_decode($rule->purchase_history_status_list, true);
1116
+ $query = array(
1117
+ 'numberposts' => -1,
1118
+ 'meta_value' => $email,
1119
+ 'post_type' => wc_get_order_types(),
1120
+ 'post_status' => $purchase_history_status_list,
1121
+ );
1122
  if(!empty($email)){
1123
+ $query['meta_key'] = '_billing_email';
 
 
 
 
 
 
1124
  } else {
1125
+ $query['meta_key'] = '_customer_user';
1126
+ }
1127
+ if($purchased_history_duration != 'all_time'){
1128
+ $days = false;
1129
+ if(in_array($purchased_history_duration, array('7_days', '14_days', '30_days', '60_days', '90_days', '180_days'))){
1130
+ $split_days = explode('_', $purchased_history_duration);
1131
+ if(isset($split_days['0'])){
1132
+ if(((int)$split_days['0']) > 0){
1133
+ $days = '- '.(int)$split_days['0'].' days';
1134
+ }
1135
+ }
1136
+
1137
+ } else if($purchased_history_duration == '1_year'){
1138
+ $days = '- 1 years';
1139
+ } else if($purchased_history_duration == 'custom_days'){
1140
+ if($purchased_history_duration_days > 0 ){
1141
+ $purchased_history_duration_days = (int)$purchased_history_duration_days;
1142
+ $days = '- '.$purchased_history_duration_days.' days';
1143
+ }
1144
+ }
1145
+ if($days !== false){
1146
+ $query['date_query'] = array(
1147
+ 'column' => 'post_date',
1148
+ 'after' => $days
1149
+ );
1150
+ }
1151
  }
1152
+ $customerOrders = get_posts( $query );
1153
+ $totalPurchasedAmount = $totalOrder = $totalQuantityPurchased = 0;
1154
  if(!empty($customerOrders)){
1155
  foreach ($customerOrders as $customerOrder) {
1156
  $order = FlycartWoocommerceOrder::wc_get_order($customerOrder->ID);
1157
  $total = FlycartWoocommerceOrder::get_total($order);
1158
+ if($rule->based_on_purchase_history == 3 || $rule->based_on_purchase_history == 4){
1159
  $products = $this->getPurchasedProductsFromRule($rule);
1160
  $product_ids = FlycartWoocommerceOrder::get_product_ids($order);
1161
  if(!empty($products)){
1163
  continue;
1164
  }
1165
  }
1166
+ $product_quantities = FlycartWoocommerceOrder::get_product_quantities($order);
1167
+ if(!empty($product_quantities) && !empty($products)){
1168
+ foreach ($products as $product_id){
1169
+ if(isset($product_quantities[$product_id])){
1170
+ $totalQuantityPurchased += $product_quantities[$product_id];
1171
+ }
1172
+ }
1173
+ }
1174
  }
1175
  $totalPurchasedAmount += $total;
1176
  $totalOrder++;
1180
  if($rule->based_on_purchase_history == 2 || $rule->based_on_purchase_history == 3){
1181
  $totalAmount = $totalOrder;
1182
  }
1183
+ if($rule->based_on_purchase_history == 4){
1184
+ $totalAmount = $totalQuantityPurchased;
1185
+ }
1186
  $purchased_history_type = isset($rule->purchased_history_type)? $rule->purchased_history_type: 'atleast';
1187
  if($purchased_history_type == 'less_than_or_equal'){
1188
  if($totalAmount <= $rule->purchased_history_amount){
2180
  public function isItemInSaleItems($rule_exclude_sale_items, $product)
2181
  {
2182
  if (!$rule_exclude_sale_items) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
2183
 
2184
+ return FlycartWoocommerceProduct::is_product_is_on_sale($product);
 
 
 
2185
  }
2186
 
2187
  /**
2837
  if(!is_array($purchasedProduct)){
2838
  $purchasedProduct = array();
2839
  }
2840
+ $variants = null;
2841
+ $purchasedProduct = apply_filters('woo_discount_rule_products_to_include', $purchasedProduct, $rule, $variants);
2842
+
2843
  return $purchasedProduct;
2844
  }
2845
 
3664
  if (!$product->is_type($excluded_product_type)) {
3665
  $product_id = FlycartWoocommerceProduct::get_id($product);
3666
  // if(!empty(self::$product_on_sale_details[$product_id])){
3667
+ $sale_price = FlycartWoocommerceProduct::get_sale_price($product);
3668
  $regular_price = FlycartWoocommerceProduct::get_regular_price($product);
3669
+ if($sale_price <= 0){
3670
  $item_price = '<span class="cart_price wdr_product_strikeout">';
3671
  $regular_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $regular_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $regular_price);
3672
  $price_to_display = FlycartWoocommerceProduct::wc_price($regular_price);
3818
  $return['status'] = 1;
3819
  $return['price_html'] = $price_html;
3820
  $return['product_type'] = $product->get_type();
3821
+ if($product->get_type() == 'variation'){
3822
+ $return['has_single_price'] = 0;
3823
+ $parent_id = FlycartWoocommerceProduct::get_parent_id($product);
3824
+ $return['parent_id'] = $parent_id;
3825
+ if($parent_id){
3826
+ $parent_product = FlycartWoocommerceProduct::wc_get_product($parent_id);
3827
+ if(method_exists($parent_product, 'get_variation_price')){
3828
+ $variation_min_price = $parent_product->get_variation_price('min');
3829
+ $variation_max_price = $parent_product->get_variation_price('max');
3830
+ if($variation_min_price == $variation_max_price){
3831
+ $return['has_single_price'] = 1;
3832
+ }
3833
+ }
3834
+ }
3835
+ }
3836
  }
3837
  echo json_encode($return);
3838
  exit;
3848
  protected function getOriginalStrikeoutPriceOfProduct($product){
3849
  $product_id = FlycartWoocommerceProduct::get_id($product);
3850
  $product_type = $product->get_type();
3851
+ $sale_price = FlycartWoocommerceProduct::get_sale_price($product);
3852
  $regular_price = FlycartWoocommerceProduct::get_regular_price($product);
3853
+ if($sale_price > 0){
3854
+ $html = '<span class="cart_price wdr_product_strikeout">';
3855
+ $regular_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $regular_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $regular_price);
3856
  $sale_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $sale_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $sale_price);
 
3857
  if($product_type == 'variation'){
3858
+ $html .= '<span class="price">';
3859
  }
3860
+ $html .= "<del>".FlycartWoocommerceProduct::wc_price($regular_price)."</del>";
3861
+ $html .= "<ins>".FlycartWoocommerceProduct::wc_price($sale_price)."</ins>";
3862
  if($product_type == 'variation'){
3863
  $html .= '</span>';
3864
  }
3865
+ $html .= '</span>';
3866
  } else {
3867
+ $sale_price = FlycartWoocommerceProduct::get_price($product);
 
3868
  $sale_price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product, 1, $sale_price) : FlycartWoocommerceProduct::get_price_including_tax($product, 1, $sale_price);
3869
+ $html = '';
3870
  if($product_type == 'variation'){
3871
+ $html = '<span class="price">';
3872
  }
3873
+ $html .= FlycartWoocommerceProduct::wc_price($sale_price);
 
3874
  if($product_type == 'variation'){
3875
  $html .= '</span>';
3876
  }
 
3877
  }
3878
 
3879
  return $html;
loader.php CHANGED
@@ -214,13 +214,14 @@ if(!class_exists('FlycartWooDiscountRules')){
214
  /**
215
  * Script on product page for loading variant strikeout
216
  * */
217
- public function script_on_product_page(){
 
218
  $runVariationStrikeoutAjax = apply_filters('woo_discount_rules_run_variation_strikeout_through_ajax', true);
219
  $script = '<script>';
220
  $script .= 'if(flycart_woo_discount_rules_strikeout_script_executed == undefined){';
221
  $script .= 'jQuery( document ).ready( function() {';
222
  $enable_variable_product_cache = $this->discountBase->getConfigData('enable_variable_product_cache', 0);
223
- if((FlycartWooDiscountRulesGeneralHelper::showDiscountOnProductPage()) && $runVariationStrikeoutAjax) {
224
  $script .= 'jQuery( ".single_variation_wrap" ).on( "show_variation", function ( event, variation, purchasable ) {';
225
  $script .= ' var container = jQuery(".single_variation .woocommerce-variation-price");';
226
  $script .= ' var current_object = jQuery(this);
@@ -244,7 +245,7 @@ if(!class_exists('FlycartWooDiscountRules')){
244
  });';
245
  $script .= ' });';
246
  }
247
- if($enable_variable_product_cache){
248
  $script .= ' var woo_discount_rules_session_storage_id = "woo_discount_rules_session_storage_id_";
249
  var woo_discount_rules_session_storage_time_id = "woo_discount_rules_session_storage_time_id_";
250
  const WOO_DISCOUNT_RULES = {
@@ -277,38 +278,41 @@ if(!class_exists('FlycartWooDiscountRules')){
277
 
278
  $script .= ' if(jQuery(".woo_discount_rules_variant_table").length > 0){
279
  var p_id = jQuery( ".woo_discount_rules_variant_table" ).attr("data-id");';
280
- if($enable_variable_product_cache) {
281
  $script .= ' var already_exists = WOO_DISCOUNT_RULES.checkSessionStorageExists(p_id);';
282
  $script .= ' var last_storage_time = WOO_DISCOUNT_RULES.getSessionStorageTime(p_id);';
283
  } else {
284
  $script .= ' var already_exists = 0;';
285
  $script .= ' var last_storage_time = "";';
286
  }
287
- $script .= ' setTimeout(function(){
288
- jQuery.ajax({
289
- url: woo_discount_rules.ajax_url,
290
- type: "POST",
291
- data: {action: "loadWooDiscountedDiscountTable", id: p_id, loaded: already_exists, time: last_storage_time},
292
- beforeSend: function() {
293
- },
294
- complete: function() {
295
- },
296
- success: function (response) {
297
- responseData = jQuery.parseJSON(response);
298
- if(responseData.cookie == "1" && already_exists){';
299
- if($enable_variable_product_cache) {
300
- $script .= ' jQuery(".woo_discount_rules_variant_table").html(WOO_DISCOUNT_RULES.getSessionStorage(p_id));';
301
- }
302
- $script .= ' } else {
303
- jQuery(".woo_discount_rules_variant_table").html(responseData.html);';
304
- if($enable_variable_product_cache) {
305
- $script .= ' WOO_DISCOUNT_RULES.setSessionStorage(p_id, responseData.html);
306
- WOO_DISCOUNT_RULES.setSessionStorageTime(p_id, responseData.time);';
 
 
 
 
 
 
 
307
  }
308
- $script .= ' }
309
- }
310
- });
311
- }, 1);';
312
  $script .= ' }';
313
  $script .= '});';
314
  $script .= 'var flycart_woo_discount_rules_strikeout_script_executed = 1; }';
@@ -510,6 +514,7 @@ if(!class_exists('FlycartWooDiscountRules')){
510
  }
511
  }
512
  }
 
513
  $sets[$string] = $all_excluded_products;
514
  }
515
 
214
  /**
215
  * Script on product page for loading variant strikeout
216
  * */
217
+ public function script_on_product_page()
218
+ {
219
  $runVariationStrikeoutAjax = apply_filters('woo_discount_rules_run_variation_strikeout_through_ajax', true);
220
  $script = '<script>';
221
  $script .= 'if(flycart_woo_discount_rules_strikeout_script_executed == undefined){';
222
  $script .= 'jQuery( document ).ready( function() {';
223
  $enable_variable_product_cache = $this->discountBase->getConfigData('enable_variable_product_cache', 0);
224
+ if ((FlycartWooDiscountRulesGeneralHelper::showDiscountOnProductPage()) && $runVariationStrikeoutAjax) {
225
  $script .= 'jQuery( ".single_variation_wrap" ).on( "show_variation", function ( event, variation, purchasable ) {';
226
  $script .= ' var container = jQuery(".single_variation .woocommerce-variation-price");';
227
  $script .= ' var current_object = jQuery(this);
245
  });';
246
  $script .= ' });';
247
  }
248
+ if ($enable_variable_product_cache) {
249
  $script .= ' var woo_discount_rules_session_storage_id = "woo_discount_rules_session_storage_id_";
250
  var woo_discount_rules_session_storage_time_id = "woo_discount_rules_session_storage_time_id_";
251
  const WOO_DISCOUNT_RULES = {
278
 
279
  $script .= ' if(jQuery(".woo_discount_rules_variant_table").length > 0){
280
  var p_id = jQuery( ".woo_discount_rules_variant_table" ).attr("data-id");';
281
+ if ($enable_variable_product_cache) {
282
  $script .= ' var already_exists = WOO_DISCOUNT_RULES.checkSessionStorageExists(p_id);';
283
  $script .= ' var last_storage_time = WOO_DISCOUNT_RULES.getSessionStorageTime(p_id);';
284
  } else {
285
  $script .= ' var already_exists = 0;';
286
  $script .= ' var last_storage_time = "";';
287
  }
288
+ $enable_discount_table = $this->discountBase->getConfigData('show_discount_table', 'show');
289
+ if(in_array($enable_discount_table, array('show', 'advance'))){
290
+ $script .= ' setTimeout(function(){
291
+ jQuery.ajax({
292
+ url: woo_discount_rules.ajax_url,
293
+ type: "POST",
294
+ data: {action: "loadWooDiscountedDiscountTable", id: p_id, loaded: already_exists, time: last_storage_time},
295
+ beforeSend: function() {
296
+ },
297
+ complete: function() {
298
+ },
299
+ success: function (response) {
300
+ responseData = jQuery.parseJSON(response);
301
+ if(responseData.cookie == "1" && already_exists){';
302
+ if ($enable_variable_product_cache) {
303
+ $script .= ' jQuery(".woo_discount_rules_variant_table").html(WOO_DISCOUNT_RULES.getSessionStorage(p_id));';
304
+ }
305
+ $script .= ' } else {
306
+ jQuery(".woo_discount_rules_variant_table").html(responseData.html);';
307
+ if ($enable_variable_product_cache) {
308
+ $script .= ' WOO_DISCOUNT_RULES.setSessionStorage(p_id, responseData.html);
309
+ WOO_DISCOUNT_RULES.setSessionStorageTime(p_id, responseData.time);';
310
+ }
311
+ $script .= ' }
312
+ }
313
+ });
314
+ }, 1);';
315
  }
 
 
 
 
316
  $script .= ' }';
317
  $script .= '});';
318
  $script .= 'var flycart_woo_discount_rules_strikeout_script_executed = 1; }';
514
  }
515
  }
516
  }
517
+ $all_excluded_products = array_unique($all_excluded_products);
518
  $sets[$string] = $all_excluded_products;
519
  }
520
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
  Tested up to: 5.2
7
- Stable tag: 1.7.19
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -318,6 +318,17 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
318
 
319
  == Changelog ==
320
 
 
 
 
 
 
 
 
 
 
 
 
321
  = 1.7.19 - 26/08/19 =
322
  * Feature - Option to do strikeout on change quantity in product page.
323
  * Feature - Option to display strikeout on after a rule condition is matched in product page.
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
  Tested up to: 5.2
7
+ Stable tag: 1.7.20
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
318
 
319
  == Changelog ==
320
 
321
+ = 1.7.20 - 23/09/19 =
322
+ * Feature - Option for Product in list, Exclude product, Exclude on sale product in cart rules.
323
+ * Feature - Duration option(Last 7 days, 14 days, 30 days, 60 days, 90 days, 180 days, 1 year, Custom) in purchase history based rules.
324
+ * Improvement - Include variant while parent product is selected in Purchase history based rule.
325
+ * Improvement - Send params in JS event woo_discount_rules_after_display_strikeout_price_on_quantity_update.
326
+ * Improvement - Not to trigger ajax for loading discount table if table is disabled.
327
+ * Improvement - Dynamic strikeout improvement to change the price for variable product header price while having single price for all variants.
328
+ * Improvement - Event apply_filters('woo_discount_rules_class_to_refresh_the_checkout_review_on_blur', 'input#billing_email, select#billing_state');
329
+ * Improvement - Display update notice through update check when there is no update available.
330
+ * Fix - Not displaying sale price with strike out because of sale adjustment handled by Woo discount plugin.
331
+
332
  = 1.7.19 - 26/08/19 =
333
  * Feature - Option to do strikeout on change quantity in product page.
334
  * Feature - Option to display strikeout on after a rule condition is matched in product page.
view/view-cart-rules.php CHANGED
@@ -29,10 +29,11 @@ $discount_rules = array();
29
  if (isset($data->discount_rule)) {
30
  $discount_rules = (is_string($data->discount_rule) ? json_decode($data->discount_rule, true) : array('' => ''));
31
  }
32
-
33
  foreach ($discount_rules as $index => $rule) {
34
  foreach ($rule as $id => $value) {
35
- $discounts[$id] = $value;
 
 
36
  }
37
  }
38
  $discount_rules = $discounts;
@@ -217,6 +218,26 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
217
  <?php } ?>
218
  </option>
219
  </optgroup>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  <optgroup label="<?php esc_attr_e('Categories In Cart', 'woo-discount-rules'); ?>">
221
  <option
222
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="categories_in" <?php
@@ -366,6 +387,16 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
366
  <?php esc_html_e('Number of previous orders made with following products', 'woo-discount-rules'); ?>
367
  <?php } ?>
368
  </option>
 
 
 
 
 
 
 
 
 
 
369
  </optgroup>
370
  <optgroup label="<?php esc_attr_e('Coupon applied', 'woo-discount-rules'); ?>">
371
  <option
@@ -395,7 +426,14 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
395
  </div>
396
  </div>
397
  <div class="col-md-3 form-group">
398
- <label> <?php esc_html_e('Value', 'woo-discount-rules'); ?>
 
 
 
 
 
 
 
399
  <?php
400
  $users_list = array();
401
  $class = 'style="display:none"';
@@ -433,6 +471,39 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
433
  </select>
434
  </div>
435
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  $coupon_list = array();
437
  $class = 'style="display:none"';
438
  if (in_array($type, array('coupon_applied_any_one', 'coupon_applied_all_selected'))) {
@@ -512,13 +583,16 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
512
  $order_status_list = array();
513
  $class = 'style="display:none"';
514
  $woocommerce_order_status = wc_get_order_statuses();
515
- $purchased_history_amount = '';
516
  $purchased_history_type = 'atleast';
 
517
  $purchase_history_status_list = $product_purchase_history_list = array();
518
- if ($type == 'customer_based_on_purchase_history' || $type == 'customer_based_on_purchase_history_order_count' || $type == 'customer_based_on_purchase_history_product_order_count') {
519
  $purchase_history_status_list = isset($discount_rules[$type]['purchase_history_order_status'])? $discount_rules[$type]['purchase_history_order_status'] : array();
520
  $purchased_history_amount = isset($discount_rules[$type]['purchased_history_amount'])? $discount_rules[$type]['purchased_history_amount'] : 0;
521
  $purchased_history_type = isset($discount_rules[$type]['purchased_history_type'])? $discount_rules[$type]['purchased_history_type'] : 'atleast';
 
 
522
  if(empty($purchase_history_status_list)){
523
  $purchase_history_status_list[] = 'wc-completed';
524
  }
@@ -535,7 +609,7 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
535
  }
536
  } ?>
537
  <div id="purchase_history_div_<?php echo $i; ?>" <?php echo $class; ?>>
538
- <div class="form-group<?php echo ($type == 'customer_based_on_purchase_history_product_order_count')? '': ' wdr_hide';?>" id="purchase_history_products_list_<?php echo $i; ?>">
539
  <?php
540
  echo FlycartWoocommerceProduct::getProductAjaxSelectBox($product_purchase_history_list, 'discount_rule['.$i.'][purchase_history_products]');
541
  ?>
@@ -556,6 +630,20 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
556
  value="<?php echo $index; ?>"<?php if (in_array($index, $purchase_history_status_list)) { ?> selected=selected <?php } ?>><?php echo $woocommerce_order_sts; ?></option>
557
  <?php } ?>
558
  </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  </div>
560
  <?php
561
  if ($hit) {
29
  if (isset($data->discount_rule)) {
30
  $discount_rules = (is_string($data->discount_rule) ? json_decode($data->discount_rule, true) : array('' => ''));
31
  }
 
32
  foreach ($discount_rules as $index => $rule) {
33
  foreach ($rule as $id => $value) {
34
+ if(!in_array($id, array('product_variants'))){
35
+ $discounts[$id] = $value;
36
+ }
37
  }
38
  }
39
  $discount_rules = $discounts;
218
  <?php } ?>
219
  </option>
220
  </optgroup>
221
+ <optgroup label="<?php esc_attr_e('Products', 'woo-discount-rules'); ?>">
222
+ <option
223
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="products_in_list" <?php
224
+ } ?>
225
+ <?php if ($type == 'products_in_list') { ?> selected="selected"
226
+ <?php } ?>><?php esc_html_e('Products in cart', 'woo-discount-rules'); ?>
227
+ </option>
228
+ <option
229
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="products_not_in_list" <?php
230
+ } ?>
231
+ <?php if ($type == 'products_not_in_list') { ?> selected="selected"
232
+ <?php } ?>><?php esc_html_e('Exclude products', 'woo-discount-rules'); ?>
233
+ </option>
234
+ <option
235
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="exclude_sale_products" <?php
236
+ } ?>
237
+ <?php if ($type == 'exclude_sale_products') { ?> selected="selected"
238
+ <?php } ?>><?php esc_html_e('Exclude on sale products', 'woo-discount-rules'); ?>
239
+ </option>
240
+ </optgroup>
241
  <optgroup label="<?php esc_attr_e('Categories In Cart', 'woo-discount-rules'); ?>">
242
  <option
243
  <?php if (!$pro) { ?> disabled <?php } else { ?> value="categories_in" <?php
387
  <?php esc_html_e('Number of previous orders made with following products', 'woo-discount-rules'); ?>
388
  <?php } ?>
389
  </option>
390
+ <option
391
+ <?php if (!$pro) { ?> disabled <?php } else { ?> value="customer_based_on_purchase_history_product_quantity_count" <?php
392
+ }
393
+ if ($type == 'customer_based_on_purchase_history_product_quantity_count') { ?> selected=selected <?php } ?>>
394
+ <?php if (!$pro) { ?>
395
+ <?php esc_html_e('Number of quantity(s) in previous orders made with following products', 'woo-discount-rules'); ?> <b><?php echo $suffix; ?></b>
396
+ <?php } else { ?>
397
+ <?php esc_html_e('Number of quantity(s) in previous orders made with following products', 'woo-discount-rules'); ?>
398
+ <?php } ?>
399
+ </option>
400
  </optgroup>
401
  <optgroup label="<?php esc_attr_e('Coupon applied', 'woo-discount-rules'); ?>">
402
  <option
426
  </div>
427
  </div>
428
  <div class="col-md-3 form-group">
429
+ <label>
430
+ <?php
431
+ $inline_attr = '';
432
+ if(in_array($type, array('exclude_sale_products'))){
433
+ $inline_attr = ' style="display:none"';
434
+ }
435
+ ?>
436
+ <span class="value_text_<?php echo $i; ?>"<?php echo $inline_attr; ?>><?php esc_html_e('Value', 'woo-discount-rules'); ?></span>
437
  <?php
438
  $users_list = array();
439
  $class = 'style="display:none"';
471
  </select>
472
  </div>
473
  <?php
474
+ $class = 'style="display:none"';
475
+ $products_list = array();
476
+ if (in_array($type, array('products_in_list', 'products_not_in_list'))) {
477
+ $class = 'style="display:block"';
478
+ $hit = true;
479
+ $products_list = isset($discount_rules[$type])? $discount_rules[$type] : array();
480
+ if(isset($products_list)){
481
+ if(!is_array($products_list)){
482
+ $products_list = json_decode((isset($products_list) ? $products_list : '{}'), true);
483
+ }
484
+ } else {
485
+ $products_list = array();
486
+ }
487
+ } ?>
488
+ <div id="products_div_<?php echo $i; ?>" <?php echo $class; ?>>
489
+ <div class="form-group" id="products_list_<?php echo $i; ?>">
490
+ <?php
491
+ echo FlycartWoocommerceProduct::getProductAjaxSelectBox($products_list, 'discount_rule['.$i.'][products]');
492
+ ?>
493
+ </div>
494
+ </div>
495
+ <?php
496
+ $class = 'style="display:none"';
497
+ if ($type == 'exclude_sale_products') {
498
+ $class = 'style="display:block"';
499
+ $hit = true;
500
+ } ?>
501
+ <div id="exclude_on_sale_products_div_<?php echo $i; ?>" <?php echo $class; ?>>
502
+ <?php
503
+ echo esc_html__('This will exclude the on sale products from discount', 'woo-discount-rules');
504
+ ?>
505
+ </div>
506
+ <?php
507
  $coupon_list = array();
508
  $class = 'style="display:none"';
509
  if (in_array($type, array('coupon_applied_any_one', 'coupon_applied_all_selected'))) {
583
  $order_status_list = array();
584
  $class = 'style="display:none"';
585
  $woocommerce_order_status = wc_get_order_statuses();
586
+ $purchased_history_amount = $purchased_history_duration_days = '';
587
  $purchased_history_type = 'atleast';
588
+ $purchased_history_duration = 'all_time';
589
  $purchase_history_status_list = $product_purchase_history_list = array();
590
+ if ($type == 'customer_based_on_purchase_history' || $type == 'customer_based_on_purchase_history_order_count' || $type == 'customer_based_on_purchase_history_product_order_count' || $type == 'customer_based_on_purchase_history_product_quantity_count') {
591
  $purchase_history_status_list = isset($discount_rules[$type]['purchase_history_order_status'])? $discount_rules[$type]['purchase_history_order_status'] : array();
592
  $purchased_history_amount = isset($discount_rules[$type]['purchased_history_amount'])? $discount_rules[$type]['purchased_history_amount'] : 0;
593
  $purchased_history_type = isset($discount_rules[$type]['purchased_history_type'])? $discount_rules[$type]['purchased_history_type'] : 'atleast';
594
+ $purchased_history_duration = isset($discount_rules[$type]['purchased_history_duration'])? $discount_rules[$type]['purchased_history_duration'] : 'all_time';
595
+ $purchased_history_duration_days = isset($discount_rules[$type]['purchased_history_duration_days'])? $discount_rules[$type]['purchased_history_duration_days'] : '';
596
  if(empty($purchase_history_status_list)){
597
  $purchase_history_status_list[] = 'wc-completed';
598
  }
609
  }
610
  } ?>
611
  <div id="purchase_history_div_<?php echo $i; ?>" <?php echo $class; ?>>
612
+ <div class="form-group<?php echo (in_array($type, array('customer_based_on_purchase_history_product_order_count', 'customer_based_on_purchase_history_product_quantity_count')))? '': ' wdr_hide';?>" id="purchase_history_products_list_<?php echo $i; ?>">
613
  <?php
614
  echo FlycartWoocommerceProduct::getProductAjaxSelectBox($product_purchase_history_list, 'discount_rule['.$i.'][purchase_history_products]');
615
  ?>
630
  value="<?php echo $index; ?>"<?php if (in_array($index, $purchase_history_status_list)) { ?> selected=selected <?php } ?>><?php echo $woocommerce_order_sts; ?></option>
631
  <?php } ?>
632
  </select>
633
+ <select class="selectpicker purchased_history_duration" data-index="<?php echo $i; ?>" name="discount_rule[<?php echo $i; ?>][purchased_history_duration]">
634
+ <option value="all_time"<?php echo ($purchased_history_duration == 'all_time')? ' selected="selected"': ''; ?>><?php esc_html_e('From all previous orders', 'woo-discount-rules'); ?></option>
635
+ <option value="7_days"<?php echo ($purchased_history_duration == '7_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 7 days', 'woo-discount-rules'); ?></option>
636
+ <option value="14_days"<?php echo ($purchased_history_duration == '14_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 14 days', 'woo-discount-rules'); ?></option>
637
+ <option value="30_days"<?php echo ($purchased_history_duration == '30_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 30 days', 'woo-discount-rules'); ?></option>
638
+ <option value="60_days"<?php echo ($purchased_history_duration == '60_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 60 days', 'woo-discount-rules'); ?></option>
639
+ <option value="90_days"<?php echo ($purchased_history_duration == '90_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 90 days', 'woo-discount-rules'); ?></option>
640
+ <option value="180_days"<?php echo ($purchased_history_duration == '180_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 180 days', 'woo-discount-rules'); ?></option>
641
+ <option value="1_year"<?php echo ($purchased_history_duration == '1_year')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 1 year', 'woo-discount-rules'); ?></option>
642
+ <option value="custom_days"<?php echo ($purchased_history_duration == 'custom_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Custom', 'woo-discount-rules'); ?></option>
643
+ </select>
644
+ <span class="purchased_history_duration_days_con" id="purchased_history_duration_days_con_<?php echo $i; ?>">
645
+ <input name="discount_rule[<?php echo $i; ?>][purchased_history_duration_days]" value="<?php echo $purchased_history_duration_days; ?>" placeholder="30" type="text"/> <?php esc_html_e('in days', 'woo-discount-rules'); ?>
646
+ </span>
647
  </div>
648
  <?php
649
  if ($hit) {
view/view-pricing-rules.php CHANGED
@@ -494,6 +494,7 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
494
  <option value="1"<?php if ($based_on_purchase_history == '1') { ?> selected=selected <?php } ?>><?php esc_html_e('Purchased amount', 'woo-discount-rules'); ?></option>
495
  <option value="2"<?php if ($based_on_purchase_history == '2') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made', 'woo-discount-rules'); ?></option>
496
  <option value="3"<?php if ($based_on_purchase_history == '3') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made with following products', 'woo-discount-rules'); ?></option>
 
497
  </select>
498
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('purchase-history-based-discounts/purchase-history-based-discount', 'purchase_history'); ?>
499
  <?php
@@ -512,6 +513,8 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
512
  <?php
513
  $purchased_history_amount = (isset($data->purchased_history_amount) ? $data->purchased_history_amount : 0);
514
  $purchased_history_type = (isset($data->purchased_history_type) ? $data->purchased_history_type : 'atleast');
 
 
515
  ?>
516
  <div class="form-group wdr_hide" id="purchase_history_products">
517
  <?php
@@ -546,6 +549,21 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
546
  value="<?php echo $index; ?>"<?php if (in_array($index, $purchase_history_status_list)) { ?> selected=selected <?php } ?>><?php echo $value; ?></option>
547
  <?php } ?>
548
  </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  </div>
550
  <?php } ?>
551
  </div>
494
  <option value="1"<?php if ($based_on_purchase_history == '1') { ?> selected=selected <?php } ?>><?php esc_html_e('Purchased amount', 'woo-discount-rules'); ?></option>
495
  <option value="2"<?php if ($based_on_purchase_history == '2') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made', 'woo-discount-rules'); ?></option>
496
  <option value="3"<?php if ($based_on_purchase_history == '3') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of previous orders made with following products', 'woo-discount-rules'); ?></option>
497
+ <option value="4"<?php if ($based_on_purchase_history == '4') { ?> selected=selected <?php } ?>><?php esc_html_e('Number of quantity(s) in previous orders made with following products', 'woo-discount-rules'); ?></option>
498
  </select>
499
  <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('purchase-history-based-discounts/purchase-history-based-discount', 'purchase_history'); ?>
500
  <?php
513
  <?php
514
  $purchased_history_amount = (isset($data->purchased_history_amount) ? $data->purchased_history_amount : 0);
515
  $purchased_history_type = (isset($data->purchased_history_type) ? $data->purchased_history_type : 'atleast');
516
+ $purchased_history_duration = (isset($data->purchased_history_duration) ? $data->purchased_history_duration : 'all_time');
517
+ $purchased_history_duration_days = (isset($data->purchased_history_duration_days) ? $data->purchased_history_duration_days : '');
518
  ?>
519
  <div class="form-group wdr_hide" id="purchase_history_products">
520
  <?php
549
  value="<?php echo $index; ?>"<?php if (in_array($index, $purchase_history_status_list)) { ?> selected=selected <?php } ?>><?php echo $value; ?></option>
550
  <?php } ?>
551
  </select>
552
+ <select class="selectpicker purchased_history_duration" id="purchased_history_duration" name="purchased_history_duration">
553
+ <option value="all_time"<?php echo ($purchased_history_duration == 'all_time')? ' selected="selected"': ''; ?>><?php esc_html_e('From all previous orders', 'woo-discount-rules'); ?></option>
554
+ <option value="7_days"<?php echo ($purchased_history_duration == '7_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 7 days', 'woo-discount-rules'); ?></option>
555
+ <option value="14_days"<?php echo ($purchased_history_duration == '14_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 14 days', 'woo-discount-rules'); ?></option>
556
+ <option value="30_days"<?php echo ($purchased_history_duration == '30_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 30 days', 'woo-discount-rules'); ?></option>
557
+ <option value="60_days"<?php echo ($purchased_history_duration == '60_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 60 days', 'woo-discount-rules'); ?></option>
558
+ <option value="90_days"<?php echo ($purchased_history_duration == '90_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 90 days', 'woo-discount-rules'); ?></option>
559
+ <option value="180_days"<?php echo ($purchased_history_duration == '180_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 180 days', 'woo-discount-rules'); ?></option>
560
+ <option value="1_year"<?php echo ($purchased_history_duration == '1_year')? ' selected="selected"': ''; ?>><?php esc_html_e('Last 1 year', 'woo-discount-rules'); ?></option>
561
+ <option value="custom_days"<?php echo ($purchased_history_duration == 'custom_days')? ' selected="selected"': ''; ?>><?php esc_html_e('Custom', 'woo-discount-rules'); ?></option>
562
+ </select>
563
+ <span class="purchased_history_duration_days_con" id="purchased_history_duration_days_con">
564
+ <input type="text" placeholder="30" value="<?php echo $purchased_history_duration_days; ?>" class="purchased_history_duration_days" name="purchased_history_duration_days"/>
565
+ <label><?php esc_html_e('in days', 'woo-discount-rules'); ?></label>
566
+ </span>
567
  </div>
568
  <?php } ?>
569
  </div>
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.7.19
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.7.20
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/