Version Description
- 07/12/17 =
- Fix - Content update for better clarification
- Fix - Product based: buy each product applied even 1 product matches
Download this release
Release Info
Developer | flycart |
Plugin | Discount Rules for WooCommerce |
Version | 1.4.31 |
Comparing to | |
See all releases |
Code changes from version 1.4.30 to 1.4.31
- includes/pricing-rules-3.php +18 -9
- includes/pricing-rules.php +19 -9
- readme.txt +17 -9
- view/view-pricing-rules.php +3 -3
- woo-discount-rules.php +1 -1
includes/pricing-rules-3.php
CHANGED
@@ -804,9 +804,8 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
804 |
$product_based_discounts = isset($rule['product_based_discount']) ? $rule['product_based_discount'] : array();
|
805 |
$discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
806 |
$discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
807 |
-
|
808 |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
|
809 |
-
$_quantity = array();
|
810 |
foreach ($product_to_buy as $key => $productId) {
|
811 |
foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
|
812 |
$_product = $values['data'];
|
@@ -817,11 +816,21 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
817 |
}
|
818 |
}
|
819 |
$quantity = WooDiscountRulesPrice_ProductBased::adjustQuantity($buy_type, $_quantity);
|
820 |
-
if(in_array($item['product_id'], $product_to_buy)){
|
821 |
-
$
|
822 |
-
if($
|
823 |
-
$
|
824 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
825 |
}
|
826 |
}
|
827 |
}
|
@@ -1324,9 +1333,9 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
1324 |
$htmlProduct = '';
|
1325 |
foreach ($product_to_buy as $product_id){
|
1326 |
$product = wc_get_product( $product_id );
|
1327 |
-
$htmlProduct .=
|
1328 |
}
|
1329 |
-
$condition .= trim($htmlProduct, ',');
|
1330 |
}
|
1331 |
$condition .= esc_html__(' and get discount in ', 'woo-discount-rules');
|
1332 |
if(count($product_to_apply)){
|
804 |
$product_based_discounts = isset($rule['product_based_discount']) ? $rule['product_based_discount'] : array();
|
805 |
$discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
806 |
$discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
807 |
+
$_quantity = array();
|
808 |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
|
|
|
809 |
foreach ($product_to_buy as $key => $productId) {
|
810 |
foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
|
811 |
$_product = $values['data'];
|
816 |
}
|
817 |
}
|
818 |
$quantity = WooDiscountRulesPrice_ProductBased::adjustQuantity($buy_type, $_quantity);
|
819 |
+
if(in_array($item['product_id'], $product_to_buy) && !empty($_quantity)){
|
820 |
+
$proceed = 1;
|
821 |
+
if($buy_type == 'each'){
|
822 |
+
$allProductsInCart = array_keys($_quantity);
|
823 |
+
$matchedProducts = array_intersect($allProductsInCart, $product_to_buy);
|
824 |
+
if(count($product_to_buy) != count($matchedProducts)){
|
825 |
+
$proceed = 0;
|
826 |
+
}
|
827 |
+
}
|
828 |
+
if($proceed){
|
829 |
+
$quantityMatched = WooDiscountRulesPrice_ProductBased::verifyQuantity($quantity_rule, $quantity, $quantity_from, $quantity_to, $buy_type);
|
830 |
+
if($quantityMatched){
|
831 |
+
$result['amount'][$discount_type] = $discount_value;
|
832 |
+
$result['apply_to']['products'] = $product_to_apply;
|
833 |
+
}
|
834 |
}
|
835 |
}
|
836 |
}
|
1333 |
$htmlProduct = '';
|
1334 |
foreach ($product_to_buy as $product_id){
|
1335 |
$product = wc_get_product( $product_id );
|
1336 |
+
$htmlProduct .= '<a href="'.$product->get_permalink().'">'.$product->get_title().'</a>, ';
|
1337 |
}
|
1338 |
+
$condition .= ' '.trim($htmlProduct, ', ').' ';
|
1339 |
}
|
1340 |
$condition .= esc_html__(' and get discount in ', 'woo-discount-rules');
|
1341 |
if(count($product_to_apply)){
|
includes/pricing-rules.php
CHANGED
@@ -810,9 +810,8 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
810 |
$product_based_discounts = isset($rule['product_based_discount']) ? $rule['product_based_discount'] : array();
|
811 |
$discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
812 |
$discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
813 |
-
|
814 |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
|
815 |
-
$_quantity = array();
|
816 |
foreach ($product_to_buy as $key => $productId) {
|
817 |
foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
|
818 |
$_product = $values['data'];
|
@@ -826,12 +825,23 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
826 |
}
|
827 |
|
828 |
$quantity = WooDiscountRulesPrice_ProductBased::adjustQuantity($buy_type, $_quantity);
|
829 |
-
if(in_array($item['product_id'], $product_to_buy)){
|
830 |
-
$
|
831 |
-
if($
|
832 |
-
$
|
833 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
834 |
}
|
|
|
835 |
}
|
836 |
}
|
837 |
return $result;
|
@@ -1332,9 +1342,9 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
|
|
1332 |
$htmlProduct = '';
|
1333 |
foreach ($product_to_buy as $product_id){
|
1334 |
$product = wc_get_product( $product_id );
|
1335 |
-
$htmlProduct .=
|
1336 |
}
|
1337 |
-
$condition .= trim($htmlProduct, ',');
|
1338 |
}
|
1339 |
$condition .= esc_html__(' and get discount in ', 'woo-discount-rules');
|
1340 |
if(count($product_to_apply)){
|
810 |
$product_based_discounts = isset($rule['product_based_discount']) ? $rule['product_based_discount'] : array();
|
811 |
$discount_type = isset($product_based_discounts['discount_type']) ? $product_based_discounts['discount_type'] : 'percentage_discount';
|
812 |
$discount_value = isset($product_based_discounts['discount_value']) ? $product_based_discounts['discount_value'] : '';
|
813 |
+
$_quantity = array();
|
814 |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
|
|
|
815 |
foreach ($product_to_buy as $key => $productId) {
|
816 |
foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
|
817 |
$_product = $values['data'];
|
825 |
}
|
826 |
|
827 |
$quantity = WooDiscountRulesPrice_ProductBased::adjustQuantity($buy_type, $_quantity);
|
828 |
+
if(in_array($item['product_id'], $product_to_buy) && !empty($_quantity)){
|
829 |
+
$proceed = 1;
|
830 |
+
if($buy_type == 'each'){
|
831 |
+
$allProductsInCart = array_keys($_quantity);
|
832 |
+
$matchedProducts = array_intersect($allProductsInCart, $product_to_buy);
|
833 |
+
if(count($product_to_buy) != count($matchedProducts)){
|
834 |
+
$proceed = 0;
|
835 |
+
}
|
836 |
+
}
|
837 |
+
if($proceed){
|
838 |
+
$quantityMatched = WooDiscountRulesPrice_ProductBased::verifyQuantity($quantity_rule, $quantity, $quantity_from, $quantity_to, $buy_type);
|
839 |
+
if($quantityMatched){
|
840 |
+
$result['amount'][$discount_type] = $discount_value;
|
841 |
+
$result['apply_to']['products'] = $product_to_apply;
|
842 |
+
}
|
843 |
}
|
844 |
+
|
845 |
}
|
846 |
}
|
847 |
return $result;
|
1342 |
$htmlProduct = '';
|
1343 |
foreach ($product_to_buy as $product_id){
|
1344 |
$product = wc_get_product( $product_id );
|
1345 |
+
$htmlProduct .= '<a href="'.$product->get_permalink().'">'.$product->get_title().'</a>, ';
|
1346 |
}
|
1347 |
+
$condition .= ' '.trim($htmlProduct, ',').' ';
|
1348 |
}
|
1349 |
$condition .= esc_html__(' and get discount in ', 'woo-discount-rules');
|
1350 |
if(count($product_to_apply)){
|
readme.txt
CHANGED
@@ -4,30 +4,34 @@ Donate link: https://flycart.org/
|
|
4 |
Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
11 |
Create simple to complex discount rules, promotions for your WooCommerce online store.
|
12 |
== Description ==
|
13 |
|
14 |
-
WooCommerce discount rules helps you to create any type of bulk discounts, dynamic pricing and advanced discount rules in your WooCommerce store. Offer Product quantity based discounts, cart based discounts at a percentage or fixed amount or Buy One and Get one (BOGO) deals. Increase your sales multifold by offering
|
15 |
|
16 |
-
Now you can set Bulk Discounts for each Product
|
17 |
|
18 |
-
Discounts will be visible in
|
19 |
|
20 |
-
Display the
|
21 |
|
22 |
[View Demo](http://demo.flycart.org/woo-discount-rules) | [Documentation with real examples](https://www.flycart.org/docs/wordpress/woo-discount-rules) | [Ask Questions](https://www.flycart.org/support) | [PRO version](https://www.flycart.org/products/wordpress/woocommerce-discount-rules) | [Examples](https://www.flycart.org/woocommerce-discount-rules-examples)
|
23 |
|
24 |
= DISCOUNT TYPES AND FEATURES =
|
25 |
|
26 |
-
* Percentage based
|
27 |
-
* Price based
|
28 |
* Product based discounts
|
29 |
-
*
|
30 |
-
*
|
|
|
|
|
|
|
|
|
31 |
* Option to set discount for each product variant.
|
32 |
* Option to set Discount for All Products or Global Discount
|
33 |
* Display or hide the Discount table in Product Page
|
@@ -233,6 +237,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
|
|
233 |
|
234 |
== Changelog ==
|
235 |
|
|
|
|
|
|
|
|
|
236 |
= 1.4.30 - 05/12/17 =
|
237 |
* Feature - Apply rule for variant products
|
238 |
|
4 |
Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
|
5 |
Requires at least: 4.4.1
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.4.31
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
11 |
Create simple to complex discount rules, promotions for your WooCommerce online store.
|
12 |
== Description ==
|
13 |
|
14 |
+
WooCommerce discount rules helps you to create any type of bulk discounts, dynamic pricing and advanced discount rules in your WooCommerce store. Offer Product quantity based discounts, cart based discounts at a percentage or fixed amount or Buy One and Get one free (BOGO) deals. Increase your sales multifold by offering dynamic pricing and discounts based on Categories, user roles, Cart items and much more.
|
15 |
|
16 |
+
Now you can set Bulk Discounts for each Product Variation
|
17 |
|
18 |
+
Discounts will be visible in product Page, product details page, cart and in email invoices.
|
19 |
|
20 |
+
Display the pricing discount table beautifully on the product page. Start selling more and retain customers by running promotions with the best dynamic pricing and discount plugin for WooCommerce.
|
21 |
|
22 |
[View Demo](http://demo.flycart.org/woo-discount-rules) | [Documentation with real examples](https://www.flycart.org/docs/wordpress/woo-discount-rules) | [Ask Questions](https://www.flycart.org/support) | [PRO version](https://www.flycart.org/products/wordpress/woocommerce-discount-rules) | [Examples](https://www.flycart.org/woocommerce-discount-rules-examples)
|
23 |
|
24 |
= DISCOUNT TYPES AND FEATURES =
|
25 |
|
26 |
+
* Percentage based discounts in WooCommerce
|
27 |
+
* Price based discounts
|
28 |
* Product based discounts
|
29 |
+
* Dynamic pricing and discounts in WooCommerce
|
30 |
+
* Option to set discounts for each variant
|
31 |
+
* Buy One and Get One Free discounts in WooCommerce (BOGO Deals)
|
32 |
+
* Cart discounts in WooCommerce
|
33 |
+
* User role based dynamic pricing and discounts for your WooCommerce store
|
34 |
+
* Dependant product based discounts (Buy Product A and get discount on Product B)
|
35 |
* Option to set discount for each product variant.
|
36 |
* Option to set Discount for All Products or Global Discount
|
37 |
* Display or hide the Discount table in Product Page
|
237 |
|
238 |
== Changelog ==
|
239 |
|
240 |
+
= 1.4.31 - 07/12/17 =
|
241 |
+
* Fix - Content update for better clarification
|
242 |
+
* Fix - Product based: buy each product applied even 1 product matches
|
243 |
+
|
244 |
= 1.4.30 - 05/12/17 =
|
245 |
* Feature - Apply rule for variant products
|
246 |
|
view/view-pricing-rules.php
CHANGED
@@ -86,16 +86,16 @@ $rule_id = (isset($data->ID)) ? $data->ID : 0;
|
|
86 |
name="rule_method" id="price_rule_method">
|
87 |
<option
|
88 |
value="qty_based" <?php if ($opt == 'qty_based') { ?> selected=selected <?php } ?>>
|
89 |
-
Quantity
|
90 |
</option>
|
91 |
<option
|
92 |
<?php if (!$pro) { ?> disabled <?php } else { ?> value="product_based" <?php
|
93 |
}
|
94 |
if ($opt == 'product_based') { ?> selected=selected <?php } ?>>
|
95 |
<?php if (!$pro) { ?>
|
96 |
-
|
97 |
<?php } else { ?>
|
98 |
-
|
99 |
<?php } ?>
|
100 |
</option>
|
101 |
</select></div>
|
86 |
name="rule_method" id="price_rule_method">
|
87 |
<option
|
88 |
value="qty_based" <?php if ($opt == 'qty_based') { ?> selected=selected <?php } ?>>
|
89 |
+
Quantity based by product/category and BOGO deals
|
90 |
</option>
|
91 |
<option
|
92 |
<?php if (!$pro) { ?> disabled <?php } else { ?> value="product_based" <?php
|
93 |
}
|
94 |
if ($opt == 'product_based') { ?> selected=selected <?php } ?>>
|
95 |
<?php if (!$pro) { ?>
|
96 |
+
Dependant product based discount <b><?php echo $suffix; ?></b>
|
97 |
<?php } else { ?>
|
98 |
+
Dependant product based discount
|
99 |
<?php } ?>
|
100 |
</option>
|
101 |
</select></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.4.
|
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.4.31
|
9 |
* Slug: woo-discount-rules
|
10 |
* Text Domain: woo-discount-rules
|
11 |
* Requires at least: 4.6.1
|