Discount Rules for WooCommerce - Version 1.5.6

Version Description

  • 26/03/18 =
  • Feature - Option to add free quantity for BOGO rules(Pro)
  • Fix - Display strikeout price based on shop tax in product page.
  • Feature - Option to handle force refresh the cart widget.
  • Fix - Show discount table only when rule matches (Rule based on selected users)
Download this release

Release Info

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

Code changes from version 1.5.5 to 1.5.6

assets/css/style.css CHANGED
@@ -42,7 +42,7 @@
42
  font-style: italic;
43
  color: #999;
44
  }
45
- .discount_product_option_list_con, .discount_product_option_more_cheapest_con, .discount_product_percent_con, .discount_category_option_list_con{
46
  display: inline-block;
47
  }
48
  .rule_buttons_con{
42
  font-style: italic;
43
  color: #999;
44
  }
45
+ .discount_product_option_list_con, .discount_product_option_more_cheapest_con, .discount_product_percent_con, .discount_category_option_list_con, .discount_product_option_bogo_con{
46
  display: inline-block;
47
  }
48
  .rule_buttons_con{
assets/js/app.js CHANGED
@@ -145,6 +145,9 @@ function validateFields(){
145
  ' Apply for <select class="selectpicker discount_product_option" name="discount_range['+count+'][discount_product_option]"><option value="all">All selected</option><option value="any_cheapest">Any one cheapest from selected</option><option value="any_cheapest_from_all">Any one cheapest from all products</option>' +
146
  '<option value="more_than_one_cheapest_from_cat">More than one cheapest from selected category</option><option value="more_than_one_cheapest">More than one cheapest from selected</option><option value="more_than_one_cheapest_from_all">More than one cheapest from all</option>' +
147
  '</select>';
 
 
 
148
  form += '<div class="discount_product_option_more_cheapest_con hide">';
149
  form += '<label>Item count<input type="text" name="discount_range['+count+'][discount_product_items]" class="form-control" value="" placeholder="ex. 1" /></label>';
150
  form += '<label>Item quantity<input type="text" name="discount_range['+count+'][discount_product_qty]" class="form-control" value="" placeholder="ex. 1" /></label>';
@@ -433,7 +436,12 @@ function validateFields(){
433
  var discount_product = $(this).closest('.price_discount_product_list_con').find('.discount_product_option_list_con');
434
  var discount_category = $(this).closest('.price_discount_product_list_con').find('.discount_category_option_list_con');
435
  var discount_product_more_cheapest = $(this).closest('.price_discount_product_list_con').find('.discount_product_option_more_cheapest_con');
 
436
  discount_category.addClass('hide');
 
 
 
 
437
  if($(this).val() == 'any_cheapest_from_all' || $(this).val() == 'more_than_one_cheapest_from_all'){
438
  discount_product.addClass('hide');
439
  } else {
145
  ' Apply for <select class="selectpicker discount_product_option" name="discount_range['+count+'][discount_product_option]"><option value="all">All selected</option><option value="any_cheapest">Any one cheapest from selected</option><option value="any_cheapest_from_all">Any one cheapest from all products</option>' +
146
  '<option value="more_than_one_cheapest_from_cat">More than one cheapest from selected category</option><option value="more_than_one_cheapest">More than one cheapest from selected</option><option value="more_than_one_cheapest_from_all">More than one cheapest from all</option>' +
147
  '</select>';
148
+ form += '<div class="discount_product_option_bogo_con">';
149
+ form += '<label>Free quantity<input type="text" name="discount_range['+count+'][discount_bogo_qty]" class="form-control" value="" placeholder="ex. 1" /></label>';
150
+ form += '</div>';
151
  form += '<div class="discount_product_option_more_cheapest_con hide">';
152
  form += '<label>Item count<input type="text" name="discount_range['+count+'][discount_product_items]" class="form-control" value="" placeholder="ex. 1" /></label>';
153
  form += '<label>Item quantity<input type="text" name="discount_range['+count+'][discount_product_qty]" class="form-control" value="" placeholder="ex. 1" /></label>';
436
  var discount_product = $(this).closest('.price_discount_product_list_con').find('.discount_product_option_list_con');
437
  var discount_category = $(this).closest('.price_discount_product_list_con').find('.discount_category_option_list_con');
438
  var discount_product_more_cheapest = $(this).closest('.price_discount_product_list_con').find('.discount_product_option_more_cheapest_con');
439
+ var discount_product_option_bogo_con = $(this).closest('.price_discount_product_list_con').find('.discount_product_option_bogo_con');
440
  discount_category.addClass('hide');
441
+ discount_product_option_bogo_con.addClass('hide');
442
+ if($(this).val() == 'all'){
443
+ discount_product_option_bogo_con.removeClass('hide');
444
+ }
445
  if($(this).val() == 'any_cheapest_from_all' || $(this).val() == 'more_than_one_cheapest_from_all'){
446
  discount_product.addClass('hide');
447
  } else {
helper/woo-function.php CHANGED
@@ -437,6 +437,19 @@ if(!class_exists('FlycartWoocommerceCartProduct')){
437
  return $addToCart;
438
  }
439
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  }
441
  }
442
 
437
  return $addToCart;
438
  }
439
  }
440
+
441
+ /**
442
+ * set quantity
443
+ *
444
+ * @access public
445
+ * @param string $cart_item_key
446
+ * @param int $quantity
447
+ * @param boolean $refresh_totals
448
+ * @return boolean
449
+ */
450
+ public static function set_quantity( $cart_item_key, $quantity = 1, $refresh_totals = true ){
451
+ return WC()->cart->set_quantity($cart_item_key, $quantity, $refresh_totals);
452
+ }
453
  }
454
  }
455
 
includes/pricing-rules.php CHANGED
@@ -478,11 +478,13 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
478
  if($cart_item['variation_id']) $cart_product_id = $cart_item['variation_id'];
479
  if ($free_product_id == $cart_product_id) {
480
  $found = true;
 
 
481
  break;
482
  }
483
  }
484
  if ($found) {
485
- continue;
486
  } else {
487
  remove_action('woocommerce_add_to_cart', array($this, 'handleBOGODiscount'));
488
  $product = FlycartWoocommerceProduct::wc_get_product($free_product_id);
@@ -544,11 +546,13 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
544
  if($cart_item['variation_id']) $cart_product_id = $cart_item['variation_id'];
545
  if ($free_product_id == $cart_product_id) {
546
  $found = true;
 
 
547
  break;
548
  }
549
  }
550
  if ($found) {
551
- continue;
552
  } else {
553
  remove_action('woocommerce_after_cart_item_quantity_update', array($this, 'handleBOGODiscountOnUpdateQuantity'));
554
  $product = FlycartWoocommerceProduct::wc_get_product($free_product_id);
@@ -1156,20 +1160,23 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1156
  } else {
1157
  //To handle BOGO
1158
  if(!empty($productIds)) {
 
 
1159
  if($bogo){
1160
  $free_product = $this->bogo_matches;
1161
  foreach ($productIds as $productId){
 
1162
  if(isset($free_product[$productId])){
1163
- $free_product[$productId]['count'] = $free_product[$productId]['count']+1;
1164
  } else {
1165
- $free_product[$productId]['count'] = 1;
1166
  $free_product[$productId]['rule_name'] = $range->title;
1167
  }
1168
  }
1169
  $this->bogo_matches = $free_product;
1170
  $adjustment[$type] = $productIds;
1171
  } else {
1172
- $productCheapest = $this->getMoreThanOneCheapestProductFromCart($productIds, 1, count($productIds), $range);
1173
  if (!empty($productCheapest)) {
1174
  $adjustment = $productCheapest;
1175
  }
@@ -1569,58 +1576,59 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1569
  }
1570
  }
1571
  }
 
 
1572
 
1573
- if ($rule->apply_to == 'specific_products') {
1574
-
1575
- // Check with Product Filter.
1576
- $products_to_apply = json_decode($rule->product_to_apply);
1577
- $products_to_apply = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($products_to_apply);
1578
 
1579
- if ($rule->product_to_apply == null) $status = true;
1580
 
1581
- if ($rule->product_to_apply != null) {
1582
- $status = false;
1583
- if (in_array($id, $products_to_apply)) {
1584
- $status = true;
1585
- }
1586
- $variations = FlycartWoocommerceProduct::get_variant_ids($product_id);
1587
- if(!empty($variations)){
1588
- if (count(array_intersect($variations, $products_to_apply)) > 0) {
1589
  $status = true;
1590
  }
 
 
 
 
 
 
1591
  }
1592
- }
1593
- } elseif ($rule->apply_to == 'specific_category') {
1594
- // Check with Product Category Filter.
1595
- $category = FlycartWooDiscountRulesGeneralHelper::getCategoryByPost($id, true);
1596
 
1597
- if ($rule->category_to_apply == null) $status = true;
1598
 
1599
- if ($rule->category_to_apply != null) {
1600
- $productToExclude = $this->getExcludeProductsFromRule($rule);
1601
- $category_to_apply = json_decode($rule->category_to_apply);
1602
- if (isset($rule->apply_child_categories) && $rule->apply_child_categories == 1) {
1603
- $category_to_apply = $this->getAllSubCategories($category_to_apply);
 
 
 
 
 
 
 
1604
  }
1605
- FlycartWooDiscountRulesGeneralHelper::toInt($category_to_apply);
 
1606
  $status = false;
1607
  if(!in_array($id, $productToExclude))
1608
- if (count(array_intersect($category_to_apply, $category)) > 0) {
1609
- $status = true;
1610
- }
1611
  }
1612
- } else if ($rule->apply_to == 'all_products') {
1613
- $productToExclude = $this->getExcludeProductsFromRule($rule);
1614
- $status = false;
1615
- if(!in_array($id, $productToExclude))
1616
- $status = true;
1617
- }
1618
 
1619
- // check for user roles
1620
- if(isset($rule->user_roles_to_apply)){
1621
- $statusRoles = $this->checkWithUserRoles($rule);
1622
- if($statusRoles === false){
1623
- $status = false;
 
1624
  }
1625
  }
1626
 
@@ -2226,7 +2234,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2226
 
2227
  $adjustment_set = $this->matched_sets[$cart_item_key];
2228
  if(!($price > 0)){
2229
- $price = FlycartWoocommerceProduct::get_price($cart_item);
2230
  }
2231
 
2232
  if(!($price > 0)){
@@ -2234,7 +2242,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2234
  if(!empty($children) && is_array($children)){
2235
  if(isset($children[0])){
2236
  $product = FlycartWoocommerceProduct::wc_get_product($children[0]);
2237
- $price = FlycartWoocommerceProduct::get_price($product);
2238
  }
2239
  }
2240
  }
478
  if($cart_item['variation_id']) $cart_product_id = $cart_item['variation_id'];
479
  if ($free_product_id == $cart_product_id) {
480
  $found = true;
481
+ $quantity = $cart_item['quantity'];
482
+ $cart_item_key = $cart_item['key'];
483
  break;
484
  }
485
  }
486
  if ($found) {
487
+ if($quantity < $bogo_match['count']) FlycartWoocommerceCart::set_quantity($cart_item_key, $bogo_match['count']);
488
  } else {
489
  remove_action('woocommerce_add_to_cart', array($this, 'handleBOGODiscount'));
490
  $product = FlycartWoocommerceProduct::wc_get_product($free_product_id);
546
  if($cart_item['variation_id']) $cart_product_id = $cart_item['variation_id'];
547
  if ($free_product_id == $cart_product_id) {
548
  $found = true;
549
+ $quantity = $cart_item['quantity'];
550
+ $cart_item_key = $cart_item['key'];
551
  break;
552
  }
553
  }
554
  if ($found) {
555
+ if($quantity < $bogo_match['count']) FlycartWoocommerceCart::set_quantity($cart_item_key, $bogo_match['count']);
556
  } else {
557
  remove_action('woocommerce_after_cart_item_quantity_update', array($this, 'handleBOGODiscountOnUpdateQuantity'));
558
  $product = FlycartWoocommerceProduct::wc_get_product($free_product_id);
1160
  } else {
1161
  //To handle BOGO
1162
  if(!empty($productIds)) {
1163
+ $bogo_count = isset($range->discount_bogo_qty)? (int)$range->discount_bogo_qty: 1;
1164
+ if($bogo_count < 1) $bogo_count = 1;
1165
  if($bogo){
1166
  $free_product = $this->bogo_matches;
1167
  foreach ($productIds as $productId){
1168
+
1169
  if(isset($free_product[$productId])){
1170
+ $free_product[$productId]['count'] = $free_product[$productId]['count']+$bogo_count;
1171
  } else {
1172
+ $free_product[$productId]['count'] = $bogo_count;
1173
  $free_product[$productId]['rule_name'] = $range->title;
1174
  }
1175
  }
1176
  $this->bogo_matches = $free_product;
1177
  $adjustment[$type] = $productIds;
1178
  } else {
1179
+ $productCheapest = $this->getMoreThanOneCheapestProductFromCart($productIds, $bogo_count, count($productIds), $range);
1180
  if (!empty($productCheapest)) {
1181
  $adjustment = $productCheapest;
1182
  }
1576
  }
1577
  }
1578
  }
1579
+ if($status){
1580
+ if ($rule->apply_to == 'specific_products') {
1581
 
1582
+ // Check with Product Filter.
1583
+ $products_to_apply = json_decode($rule->product_to_apply);
1584
+ $products_to_apply = FlycartWoocommerceVersion::backwardCompatibilityStringToArray($products_to_apply);
 
 
1585
 
1586
+ if ($rule->product_to_apply == null) $status = true;
1587
 
1588
+ if ($rule->product_to_apply != null) {
1589
+ $status = false;
1590
+ if (in_array($id, $products_to_apply)) {
 
 
 
 
 
1591
  $status = true;
1592
  }
1593
+ $variations = FlycartWoocommerceProduct::get_variant_ids($product_id);
1594
+ if(!empty($variations)){
1595
+ if (count(array_intersect($variations, $products_to_apply)) > 0) {
1596
+ $status = true;
1597
+ }
1598
+ }
1599
  }
1600
+ } elseif ($rule->apply_to == 'specific_category') {
1601
+ // Check with Product Category Filter.
1602
+ $category = FlycartWooDiscountRulesGeneralHelper::getCategoryByPost($id, true);
 
1603
 
1604
+ if ($rule->category_to_apply == null) $status = true;
1605
 
1606
+ if ($rule->category_to_apply != null) {
1607
+ $productToExclude = $this->getExcludeProductsFromRule($rule);
1608
+ $category_to_apply = json_decode($rule->category_to_apply);
1609
+ if (isset($rule->apply_child_categories) && $rule->apply_child_categories == 1) {
1610
+ $category_to_apply = $this->getAllSubCategories($category_to_apply);
1611
+ }
1612
+ FlycartWooDiscountRulesGeneralHelper::toInt($category_to_apply);
1613
+ $status = false;
1614
+ if(!in_array($id, $productToExclude))
1615
+ if (count(array_intersect($category_to_apply, $category)) > 0) {
1616
+ $status = true;
1617
+ }
1618
  }
1619
+ } else if ($rule->apply_to == 'all_products') {
1620
+ $productToExclude = $this->getExcludeProductsFromRule($rule);
1621
  $status = false;
1622
  if(!in_array($id, $productToExclude))
1623
+ $status = true;
 
 
1624
  }
 
 
 
 
 
 
1625
 
1626
+ // check for user roles
1627
+ if(isset($rule->user_roles_to_apply)){
1628
+ $statusRoles = $this->checkWithUserRoles($rule);
1629
+ if($statusRoles === false){
1630
+ $status = false;
1631
+ }
1632
  }
1633
  }
1634
 
2234
 
2235
  $adjustment_set = $this->matched_sets[$cart_item_key];
2236
  if(!($price > 0)){
2237
+ $price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($cart_item) : FlycartWoocommerceProduct::get_price_including_tax($cart_item);
2238
  }
2239
 
2240
  if(!($price > 0)){
2242
  if(!empty($children) && is_array($children)){
2243
  if(isset($children[0])){
2244
  $product = FlycartWoocommerceProduct::wc_get_product($children[0]);
2245
+ $price = get_option('woocommerce_tax_display_shop') == 'excl' ? FlycartWoocommerceProduct::get_price_excluding_tax($product) : FlycartWoocommerceProduct::get_price_including_tax($product);
2246
  }
2247
  }
2248
  }
loader.php CHANGED
@@ -32,6 +32,7 @@ if(!class_exists('FlycartWooDiscountRules')){
32
  private static $instance;
33
  public $discountBase;
34
  public $pricingRules;
 
35
 
36
  /**
37
  * To run the plugin
@@ -48,8 +49,8 @@ if(!class_exists('FlycartWooDiscountRules')){
48
  * */
49
  public function __construct() {
50
  $this->includeFiles();
51
- $this->runUpdater();
52
  $this->discountBase = new FlycartWooDiscountBase();
 
53
  $this->pricingRules = new FlycartWooDiscountRulesPricingRules();
54
  if (is_admin()) {
55
  $this->loadAdminScripts();
@@ -82,7 +83,10 @@ if(!class_exists('FlycartWooDiscountRules')){
82
  $purchase_helper = new FlycartWooDiscountRulesPurchase();
83
  $purchase_helper->init();
84
  $update_url = $purchase_helper->getUpdateURL();
85
-
 
 
 
86
  $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
87
  $update_url,
88
  plugin_dir_path( __FILE__ ).'woo-discount-rules.php',
@@ -175,6 +179,22 @@ if(!class_exists('FlycartWooDiscountRules')){
175
 
176
  //To enable on-sale tag
177
  add_filter('woocommerce_product_is_on_sale', array($this->pricingRules, 'displayProductIsOnSaleTag'), 10, 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  }
179
  }
180
  }
32
  private static $instance;
33
  public $discountBase;
34
  public $pricingRules;
35
+ public $config;
36
 
37
  /**
38
  * To run the plugin
49
  * */
50
  public function __construct() {
51
  $this->includeFiles();
 
52
  $this->discountBase = new FlycartWooDiscountBase();
53
+ $this->runUpdater();
54
  $this->pricingRules = new FlycartWooDiscountRulesPricingRules();
55
  if (is_admin()) {
56
  $this->loadAdminScripts();
83
  $purchase_helper = new FlycartWooDiscountRulesPurchase();
84
  $purchase_helper->init();
85
  $update_url = $purchase_helper->getUpdateURL();
86
+ if(!$purchase_helper->isPro()){
87
+ $dlid = $this->discountBase->getConfigData('license_key', null);
88
+ if(empty($dlid)) return false;
89
+ }
90
  $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
91
  $update_url,
92
  plugin_dir_path( __FILE__ ).'woo-discount-rules.php',
179
 
180
  //To enable on-sale tag
181
  add_filter('woocommerce_product_is_on_sale', array($this->pricingRules, 'displayProductIsOnSaleTag'), 10, 2);
182
+
183
+ $force_refresh_cart_widget = $this->discountBase->getConfigData('force_refresh_cart_widget', 0);
184
+ if($force_refresh_cart_widget){
185
+ if (isset($_REQUEST['wc-ajax']) && ($_REQUEST['wc-ajax'] == 'add_to_cart' || $_REQUEST['wc-ajax'] == 'remove_from_cart')) {
186
+ add_action('woocommerce_before_mini_cart', array($this, 'applyRulesBeforeMiniCart'), 10);
187
+ }
188
+ }
189
+ }
190
+
191
+ /**
192
+ * To load the dynamic data in mini-cart/cart widget while add to cart and remove from cart through widget
193
+ * */
194
+ public function applyRulesBeforeMiniCart(){
195
+ WC()->cart->get_cart_from_session();
196
+ $this->discountBase->handlePriceDiscount();
197
+ WC()->cart->calculate_totals();
198
  }
199
  }
200
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
- Stable tag: 1.5.5
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -241,6 +241,12 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
241
 
242
  == Changelog ==
243
 
 
 
 
 
 
 
244
  = 1.5.5 - 19/03/18 =
245
  * Improvement - Cart rule UI content improvement
246
 
4
  Tags: woocommerce, discounts, dynamic pricing, Buy One Get One Free, pricing deals, price rules, bulk discounts, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
+ Stable tag: 1.5.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
241
 
242
  == Changelog ==
243
 
244
+ = 1.5.6 - 26/03/18 =
245
+ * Feature - Option to add free quantity for BOGO rules(Pro)
246
+ * Fix - Display strikeout price based on shop tax in product page.
247
+ * Feature - Option to handle force refresh the cart widget.
248
+ * Fix - Show discount table only when rule matches (Rule based on selected users)
249
+
250
  = 1.5.5 - 19/03/18 =
251
  * Improvement - Cart rule UI content improvement
252
 
view/settings.php CHANGED
@@ -245,6 +245,18 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
245
  <label><input type="radio" name="do_not_run_while_have_third_party_coupon" value="0" <?php echo ($data['do_not_run_while_have_third_party_coupon'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
246
  </div>
247
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
248
  <div class="row form-group" style="display: none"><!-- Hide this because it is not required after v1.4.36 -->
249
  <div class="col-md-2">
250
  <label>
245
  <label><input type="radio" name="do_not_run_while_have_third_party_coupon" value="0" <?php echo ($data['do_not_run_while_have_third_party_coupon'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
246
  </div>
247
  </div>
248
+ <div class="row form-group">
249
+ <div class="col-md-2">
250
+ <label>
251
+ <?php esc_html_e('Force refresh the cart widget while add and remove item to cart', 'woo-discount-rules'); ?>
252
+ </label>
253
+ </div>
254
+ <?php $data['force_refresh_cart_widget'] = (isset($data['force_refresh_cart_widget']) ? $data['force_refresh_cart_widget'] : 0); ?>
255
+ <div class="col-md-6">
256
+ <label><input type="radio" name="force_refresh_cart_widget" value="1" <?php echo ($data['force_refresh_cart_widget'] == 1)? 'checked': '' ?>/> <?php esc_html_e('Yes', 'woo-discount-rules'); ?></label>
257
+ <label><input type="radio" name="force_refresh_cart_widget" value="0" <?php echo ($data['force_refresh_cart_widget'] == 0)? 'checked': '' ?> /> <?php esc_html_e('No', 'woo-discount-rules'); ?></label>
258
+ </div>
259
+ </div>
260
  <div class="row form-group" style="display: none"><!-- Hide this because it is not required after v1.4.36 -->
261
  <div class="col-md-2">
262
  <label>
view/view-pricing-rules.php CHANGED
@@ -437,6 +437,15 @@ $isPro = (new FlycartWooDiscountRulesPurchase())->isPro();
437
  <option value="more_than_one_cheapest"<?php echo ($discount_product_option == 'more_than_one_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('More than one cheapest from selected', 'woo-discount-rules') ?></option>
438
  <option value="more_than_one_cheapest_from_all"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('More than one cheapest from all', 'woo-discount-rules') ?></option>
439
  </select>
 
 
 
 
 
 
 
 
 
440
  <div class="discount_product_option_more_cheapest_con hide">
441
  <label>Item count
442
  <input type="text"
437
  <option value="more_than_one_cheapest"<?php echo ($discount_product_option == 'more_than_one_cheapest')? ' selected="selected"': '' ?>><?php esc_html_e('More than one cheapest from selected', 'woo-discount-rules') ?></option>
438
  <option value="more_than_one_cheapest_from_all"<?php echo ($discount_product_option == 'more_than_one_cheapest_from_all')? ' selected="selected"': '' ?>><?php esc_html_e('More than one cheapest from all', 'woo-discount-rules') ?></option>
439
  </select>
440
+ <div class="discount_product_option_bogo_con hide">
441
+ <label>Free quantity
442
+ <input type="text"
443
+ name="discount_range[<?php echo $fieldIndex; ?>][discount_bogo_qty]"
444
+ class="form-control"
445
+ value="<?php echo(isset($discount->discount_bogo_qty) ? $discount->discount_bogo_qty : 1); ?>"
446
+ placeholder="ex. 1" />
447
+ </label>
448
+ </div>
449
  <div class="discount_product_option_more_cheapest_con hide">
450
  <label>Item count
451
  <input type="text"
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.5.5
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.5.6
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1