WooCommerce Bulk Discount - Version 3.0

Version Description

  • (31 Jan 2021) New major release.
Download this release

Release Info

Developer Rene Puchinger
Plugin Icon 128x128 WooCommerce Bulk Discount
Version 3.0
Comparing to
See all releases

Code changes from version 2.4.5 to 3.0

Files changed (2) hide show
  1. readme.txt +26 -74
  2. woocommerce-bulk-discount.php +10 -4
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: Rene Puchinger
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6VEQ8XXK6B3UE
4
  Tags: woocommerce, bulk, discount
5
- Requires at least: 3.6
6
- Tested up to: 4.9.4
7
- Stable tag: 2.4.5
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -12,31 +12,24 @@ Apply fine-grained bulk discounts to items in the shopping cart.
12
 
13
  == Description ==
14
 
15
- WooCommerce Bulk Discount makes it possible to apply fine-grained bulk discounts to items in the shopping cart,
16
- depending on the ordered quantity and on the specific product.
17
 
18
- **WooCommerce Bulk Discount is compatible with WooCommerce 2.0 to 3.3.**
19
 
20
  Let us examine some examples of usage.
21
 
22
- * You may want to feature the following discount policy in your store: if the customer
23
- orders more than 5 items of a given product, he/she will pay the price of this order
24
- line lowered by 10%.
25
 
26
- * Or you may want a different policy, for example offering a 5% discount if the customer
27
- orders more than 10 items of a product and a 10% discount if he/she orders more than
28
- 20 items.
29
 
30
- * Bulk Discounts supports fixed and flat discounts in currency units as well,
31
- enabling you to handle scenarios like deducting a specific value of, say $10 from the item subtotal.
32
- For example, when the customer orders more than 10 items (say, 15, 20, etc.), a discount of $10
33
- will be applied only on the subtotal price.
34
 
35
- The settings for discounts are simple yet extensive, allowing wide range of discount
36
- policies to be adopted in your store.
37
 
38
  Here is the list of the main features:
39
 
 
 
40
  * Possibility to set percentage, fixed or flat bulk discount in currency units. (see FAQ section for details)
41
  * Possibility to set the discount individually per product.
42
  * Possibility to set the discount globally for all products.
@@ -51,18 +44,10 @@ Here is the list of the main features:
51
  * HTML markup is allowed in information about the bulk discount offer in Product Description.
52
  * Bulk Discount can be disabled more easily in the Product Options page.
53
 
54
- WooCommerce Bulk Discount has been localised to these languages:
55
-
56
- * English
57
- * Czech
58
-
59
- Note: Due to important changes in the localization files (mainly with regards to the fixed / flat discount differences) I decided to drop
60
- the other localizations. If you use any localization other than above make sure to check and edit your localization files.
61
-
62
  **If you like WooCommerce Bulk Discount, please also check out these premium plugins:**
63
 
64
- * <a href="http://codecanyon.net/item/woocommerce-free-gift/6144902?ref=renp">WooCommerce Free Gift</a>
65
- * <a href="http://codecanyon.net/item/woocommerce-gift-coupons/6207561?ref=renp">WooCommerce Gift Coupons</a>
66
 
67
  == Installation ==
68
 
@@ -71,23 +56,11 @@ the other localizations. If you use any localization other than above make sure
71
 
72
  Once the plugin is activated, you can use it as follows:
73
 
74
- 1. First navigate to WooCommerce settings. Under the Bulk Discount tab, find the global
75
- configuration for bulk discounts. Make sure "Bulk Discount enabled" is checked and optionally
76
- fill information about discounts which will be visible on the cart page. You can include HTML
77
- markup in the text - you can, for instance, include a link to your page with your discount
78
- policy. Since version 2.0 you may choose to use a flat discount applied to the cart item subtotal. Optionally you may also
79
- modify the CSS styles for the old value and the new value which is displayed in the cart.
80
- Save the settings.
81
 
82
- 2. If you want to set the discount individually per product then navigate to Products and choose a product for which you want
83
- to create a discount policy. In the Product Data panel, click Bulk Discount and optionally fill information about the discount
84
- which will be visible in the product description. If you want to set the discount policy globally for all products, just create
85
- a private product with the title 'wc_bulk_discount_configurer' (without quotes). In the bulk discount section of this private
86
- product set the discount as in the case of any individual product (see step 3).
87
 
88
- 3. Click "Add discount line" button to create a policy. Quantity (min.) means minimal
89
- number of ordered items so that the (second textbox) Discount applies. It is possible to
90
- add up to five discount lines to fine-tune the discount setting.
91
 
92
  == Frequently Asked Questions ==
93
 
@@ -97,17 +70,13 @@ Yes, multiple discounts (related to a single product) are supported. Currently i
97
  set up to 5 discount lines. That should be enough for reasonable fine-tuning of the discount.
98
 
99
  = Is only a percentage discount implemented? =
100
- Since version 2.0 another type of discount is added, allowing you to set a flat discount in currency units
101
- for the cart item subtotal. Since version 2.4.2 you can add a fixed discount type which is a bit different than
102
- the flat discount type - see below for examples.
103
 
104
  = Will the discount be visible on WooCommerce e-mails and Order status as well? =
105
  Yes. Since version 2.0, this feature has been implemented.
106
 
107
  = Is it possible to handle discount for product variations as a whole? =
108
- Yes, in case you have several product variations in your store and you need to apply the discount
109
- to all the purchased variations, please upgrade to the latest version of Bulk Discount.
110
- This functionality can be disabled in Bulk Discount settings.
111
 
112
  = Is the plugin i18n ready? =
113
  Yes, the plugin supports localization files. You can add support for your language as well by the standard process.
@@ -119,10 +88,7 @@ Sure. Below is an example of setting a bulk discount for a product with three di
119
  2. Quantity (min.) = 8, Discount (%) = 10
120
  3. Quantity (min.) = 15, Discount (%) = 15
121
 
122
- If the customer orders, say, 12 items of the product which costs $15 per item, the second
123
- discount line will apply. The customer then pays 12 * 15 = 225 dollars in total minus
124
- 10%, which yields $202.5. Note that this discount policy only applies to the concrete product -- other
125
- products may have their own (possibly different) discount policies.
126
 
127
  = Can you provide an example of setting a flat bulk discount? =
128
  Example for flat discount follows:
@@ -130,9 +96,7 @@ Example for flat discount follows:
130
  1. Quantity (min.) = 10, Discount ($) = 10
131
  2. Quantity (min.) = 30, Discount ($) = 20
132
 
133
- If the customer orders, say, 15 items of the product which costs $10 per item, the first discount
134
- line will apply and the customer will pay (15 * 10) - 10 dollars. If the customers orders
135
- 50 items, the second discount line will apply and the final price will be (50 * 10) - 20 dollars.
136
 
137
  = Can you provide an example of setting a fixed bulk discount? =
138
  Example for fixed discount follows:
@@ -140,19 +104,13 @@ Example for fixed discount follows:
140
  1. Quantity (min.) = 10, Discount ($) = 2
141
  2. Quantity (min.) = 30, Discount ($) = 3
142
 
143
- If the customer orders, say, 15 items of the product which costs $10 per item, the first discount
144
- line will apply and the customer will pay (15 * 10) - (15 * 2) = 15 * (10 - 2) dollars. If the customers orders
145
- 50 items, the second discount line will apply and the final price will be (50 * 10) - (50 * 3) = 50 * (10 - 3) dollars.
146
- **Note the difference between fixed and flat discount types!!! Flat discount is a discount from the line subtotal while fixed discount is applied on each individual quantity.**
147
 
148
  = What does mean the "Treat the variations separately" checkbox? =
149
- To illustrate what the setting means, let's have two variations: A and B of some product. Both have this bulk discount setting:
150
- quantity = 10, discount = 10%
151
- quantity = 20, discount = 50%.
152
  If we have "Treat variations separately" checked, then when we order 10 times variation A and 10 times variation B, then 10% bulk discount will be applied on both cart lines.
153
  If we have "Treat variations separately" unchecked, then when we order 10 times variation A and 10 times variation B, it will count the discount to 10 + 10 items,
154
- i.e. 20 items together and now the discount 50% will apply to both cart lines.
155
- Therefore in the first case we treated the variations separately in the computation of the discount and in the second case we treat them as shared.
156
 
157
  = How do I set the discount globally for all products? =
158
  This feature has been added to version 2.4.0 of WooCommerce Bulk Discount. If you want to set the discount policy globally for all products,
@@ -170,6 +128,9 @@ In the bulk discount section of this private product set the discount as in the
170
 
171
  == Changelog ==
172
 
 
 
 
173
  = 2.4.5 =
174
  * (09 Apr 2017) Compatibility issues with WooCommerce 3.0 resolved.
175
 
@@ -256,12 +217,6 @@ In the bulk discount section of this private product set the discount as in the
256
  = 2.0.5 =
257
  * (12 Sep 2013) Fixed a bug of incorrect discount displayed (no impact on discount computations).
258
 
259
- = 2.0.4 =
260
- * (11 Sep 2013) *unstable*
261
-
262
- = 2.0.3 =
263
- * (11 Sep 2013) *unstable*
264
-
265
  = 2.0.2 =
266
  * (5 Sep 2013) Important maintenance release. Now the bulk discount metadata are stored to orders as well, making it possible to correctly display discounts for past orders. You can also change the plugin settings any time.
267
  * Added quick link to settings on Wordpress > Plugins page.
@@ -299,9 +254,6 @@ In the bulk discount section of this private product set the discount as in the
299
  * code optimization.
300
  * cleaned up some code.
301
 
302
- = 1.0.1 =
303
- * (5 Jul 2013) *unstable*
304
-
305
  = 1.0 =
306
  * Initial version.
307
 
2
  Contributors: Rene Puchinger
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=6VEQ8XXK6B3UE
4
  Tags: woocommerce, bulk, discount
5
+ Requires at least: 4.0
6
+ Tested up to: 5.6
7
+ Stable tag: 3.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ WooCommerce Bulk Discount makes it possible to apply fine-grained bulk discounts to items in the shopping cart, depending on the ordered quantity and on the specific product.
 
16
 
17
+ **WooCommerce Bulk Discount is compatible with WooCommerce 3.7 to 4.9**
18
 
19
  Let us examine some examples of usage.
20
 
21
+ * You may want to feature the following discount policy in your store: if the customer orders more than 5 items of a given product, he/she will pay the price of this orderline lowered by 10%.
 
 
22
 
23
+ * Or you may want a different policy, for example offering a 5% discount if the customer orders more than 10 items of a product and a 10% discount if he/she orders more than 20 items.
 
 
24
 
25
+ * Bulk Discounts supports fixed and flat discounts in currency units as well, enabling you to handle scenarios like deducting a specific value of, say $10 from the item subtotal. For example, when the customer orders more than 10 items (say, 15, 20, etc.), a discount of $10 will be applied only on the subtotal price.
 
 
 
26
 
27
+ The settings for discounts are simple yet extensive, allowing wide range of discount policies to be adopted in your store.
 
28
 
29
  Here is the list of the main features:
30
 
31
+ * **NEW** Compatible with WooCommerce 4.9.
32
+ * **NEW** Supports WordPress Multisite.
33
  * Possibility to set percentage, fixed or flat bulk discount in currency units. (see FAQ section for details)
34
  * Possibility to set the discount individually per product.
35
  * Possibility to set the discount globally for all products.
44
  * HTML markup is allowed in information about the bulk discount offer in Product Description.
45
  * Bulk Discount can be disabled more easily in the Product Options page.
46
 
 
 
 
 
 
 
 
 
47
  **If you like WooCommerce Bulk Discount, please also check out these premium plugins:**
48
 
49
+ * <a href="http://codecanyon.net/item/woocommerce-free-gift/6144902?ref=themegrids">WooCommerce Free Gift</a>
50
+ * <a href="http://codecanyon.net/item/woocommerce-gift-coupons/6207561?ref=themegrids">WooCommerce Gift Coupons</a>
51
 
52
  == Installation ==
53
 
56
 
57
  Once the plugin is activated, you can use it as follows:
58
 
59
+ 1. First navigate to WooCommerce settings. Under the Bulk Discount tab, find the global configuration for bulk discounts. Make sure "Bulk Discount enabled" is checked and optionally fill information about discounts which will be visible on the cart page. You can include HTML markup in the text - you can, for instance, include a link to your page with your discount policy. Since version 2.0 you may choose to use a flat discount applied to the cart item subtotal. Optionally you may also modify the CSS styles for the old value and the new value which is displayed in the cart. Save the settings.
 
 
 
 
 
 
60
 
61
+ 2. If you want to set the discount individually per product then navigate to Products and choose a product for which you want to create a discount policy. In the Product Data panel, click Bulk Discount and optionally fill information about the discount which will be visible in the product description. If you want to set the discount policy globally for all products, just create a private product with the title 'wc_bulk_discount_configurer' (without quotes). In the bulk discount section of this private product set the discount as in the case of any individual product (see step 3).
 
 
 
 
62
 
63
+ 3. Click "Add discount line" button to create a policy. Quantity (min.) means minimal number of ordered items so that the (second textbox) Discount applies. It is possible to add up to five discount lines to fine-tune the discount setting.
 
 
64
 
65
  == Frequently Asked Questions ==
66
 
70
  set up to 5 discount lines. That should be enough for reasonable fine-tuning of the discount.
71
 
72
  = Is only a percentage discount implemented? =
73
+ Since version 2.0 another type of discount is added, allowing you to set a flat discount in currency units for the cart item subtotal. Since version 2.4.2 you can add a fixed discount type which is a bit different than the flat discount type - see below for examples.
 
 
74
 
75
  = Will the discount be visible on WooCommerce e-mails and Order status as well? =
76
  Yes. Since version 2.0, this feature has been implemented.
77
 
78
  = Is it possible to handle discount for product variations as a whole? =
79
+ Yes, in case you have several product variations in your store and you need to apply the discount to all the purchased variations, please upgrade to the latest version of Bulk Discount. This functionality can be disabled in Bulk Discount settings.
 
 
80
 
81
  = Is the plugin i18n ready? =
82
  Yes, the plugin supports localization files. You can add support for your language as well by the standard process.
88
  2. Quantity (min.) = 8, Discount (%) = 10
89
  3. Quantity (min.) = 15, Discount (%) = 15
90
 
91
+ If the customer orders, say, 12 items of the product which costs $15 per item, the second discount line will apply. The customer then pays 12 * 15 = 225 dollars in total minus 10%, which yields $202.5. Note that this discount policy only applies to the concrete product -- other products may have their own (possibly different) discount policies.
 
 
 
92
 
93
  = Can you provide an example of setting a flat bulk discount? =
94
  Example for flat discount follows:
96
  1. Quantity (min.) = 10, Discount ($) = 10
97
  2. Quantity (min.) = 30, Discount ($) = 20
98
 
99
+ If the customer orders, say, 15 items of the product which costs $10 per item, the first discount line will apply and the customer will pay (15 * 10) - 10 dollars. If the customers orders 50 items, the second discount line will apply and the final price will be (50 * 10) - 20 dollars.
 
 
100
 
101
  = Can you provide an example of setting a fixed bulk discount? =
102
  Example for fixed discount follows:
104
  1. Quantity (min.) = 10, Discount ($) = 2
105
  2. Quantity (min.) = 30, Discount ($) = 3
106
 
107
+ If the customer orders, say, 15 items of the product which costs $10 per item, the first discount line will apply and the customer will pay (15 * 10) - (15 * 2) = 15 * (10 - 2) dollars. If the customers orders 50 items, the second discount line will apply and the final price will be (50 * 10) - (50 * 3) = 50 * (10 - 3) dollars. **Note the difference between fixed and flat discount types!!! Flat discount is a discount from the line subtotal while fixed discount is applied on each individual quantity.**
 
 
 
108
 
109
  = What does mean the "Treat the variations separately" checkbox? =
110
+ To illustrate what the setting means, let's have two variations: A and B of some product. Both have this bulk discount setting: quantity = 10, discount = 10% quantity = 20, discount = 50%.
 
 
111
  If we have "Treat variations separately" checked, then when we order 10 times variation A and 10 times variation B, then 10% bulk discount will be applied on both cart lines.
112
  If we have "Treat variations separately" unchecked, then when we order 10 times variation A and 10 times variation B, it will count the discount to 10 + 10 items,
113
+ i.e. 20 items together and now the discount 50% will apply to both cart lines. Therefore in the first case we treated the variations separately in the computation of the discount and in the second case we treat them as shared.
 
114
 
115
  = How do I set the discount globally for all products? =
116
  This feature has been added to version 2.4.0 of WooCommerce Bulk Discount. If you want to set the discount policy globally for all products,
128
 
129
  == Changelog ==
130
 
131
+ = 3.0 =
132
+ * (31 Jan 2021) New major release.
133
+
134
  = 2.4.5 =
135
  * (09 Apr 2017) Compatibility issues with WooCommerce 3.0 resolved.
136
 
217
  = 2.0.5 =
218
  * (12 Sep 2013) Fixed a bug of incorrect discount displayed (no impact on discount computations).
219
 
 
 
 
 
 
 
220
  = 2.0.2 =
221
  * (5 Sep 2013) Important maintenance release. Now the bulk discount metadata are stored to orders as well, making it possible to correctly display discounts for past orders. You can also change the plugin settings any time.
222
  * Added quick link to settings on Wordpress > Plugins page.
254
  * code optimization.
255
  * cleaned up some code.
256
 
 
 
 
257
  = 1.0 =
258
  * Initial version.
259
 
woocommerce-bulk-discount.php CHANGED
@@ -4,11 +4,14 @@ Plugin Name: WooCommerce Bulk Discount
4
  Plugin URI: http://wordpress.org/plugins/woocommerce-bulk-discount/
5
  Description: Apply fine-grained bulk discounts to items in the shopping cart.
6
  Author: Rene Puchinger
7
- Version: 2.4.5
8
  Author URI: https://profiles.wordpress.org/rene-puchinger/
9
  License: GPL3
10
 
11
- Copyright (C) 2013 Rene Puchinger
 
 
 
12
 
13
  This program is free software: you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
@@ -27,7 +30,10 @@ License: GPL3
27
 
28
  if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
29
 
30
- if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; // Check if WooCommerce is active
 
 
 
31
 
32
  if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
33
 
@@ -872,7 +878,7 @@ if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
872
  // Define settings
873
  $this->fields['bulk_discount'] = apply_filters( 'woocommerce_bulk_discount_settings_fields', array(
874
 
875
- array( 'name' => __( 'Bulk Discount', 'wc_bulk_discount' ), 'type' => 'title', 'desc' => __( 'The following options are specific to product bulk discount.', 'wc_bulk_discount' ) . '<br /><br/><strong><i>' . __( 'After changing the settings, it is recommended to clear all sessions in WooCommerce &gt; System Status &gt; Tools.', 'wc_bulk_discount' ) . '</i></strong>', 'id' => 't4m_bulk_discounts_options' ),
876
 
877
  array(
878
  'title' => __( 'Discount Type', 'wc_bulk_discount' ),
4
  Plugin URI: http://wordpress.org/plugins/woocommerce-bulk-discount/
5
  Description: Apply fine-grained bulk discounts to items in the shopping cart.
6
  Author: Rene Puchinger
7
+ Version: 3.0
8
  Author URI: https://profiles.wordpress.org/rene-puchinger/
9
  License: GPL3
10
 
11
+ WC requires at least: 3.7.0
12
+ WC tested up to: 4.9
13
+
14
+ Copyright (C) 2013 - 2021 Rene Puchinger
15
 
16
  This program is free software: you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
30
 
31
  if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
32
 
33
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
34
+
35
+ if ( !is_plugin_active( 'woocommerce/woocommerce.php' ) )
36
+ return; // Check if WooCommerce is active
37
 
38
  if ( !class_exists( 'Woo_Bulk_Discount_Plugin_t4m' ) ) {
39
 
878
  // Define settings
879
  $this->fields['bulk_discount'] = apply_filters( 'woocommerce_bulk_discount_settings_fields', array(
880
 
881
+ array( 'name' => __( 'Bulk Discount', 'wc_bulk_discount' ), 'type' => 'title', 'desc' => __( 'The following options are specific to product bulk discount.', 'wc_bulk_discount' ), 'id' => 't4m_bulk_discounts_options' ),
882
 
883
  array(
884
  'title' => __( 'Discount Type', 'wc_bulk_discount' ),