WooCommerce Bulk Discount - Version 2.0.7

Version Description

  • (29 Sep 2013) Added configuration on which locations should the discount information be visible.
Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.7

Files changed (2) hide show
  1. readme.txt +8 -2
  2. woocommerce-bulk-discount.php +40 -2
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_butt
4
  Tags: woocommerce, bulk, discount
5
  Requires at least: 3.5
6
  Tested up to: 3.6
7
- Stable tag: 2.0.6
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -40,7 +40,7 @@ Here is the list of main features:
40
 
41
  * Possibility of setting percentage bulk discount or flat (fixed) bulk discount in currency units.
42
  * Bulk discount for product variations supported to treat them as a whole when discounting.
43
- * Discount is better visible and is present on more places (see below).
44
  * Discount is visible on Checkout page
45
  * Discount is visible on Order Details page
46
  * Discount is visible in WooCommerce order e-mails and invoice as well.
@@ -135,6 +135,9 @@ Setting bulk discounts couldn't have been easier.
135
 
136
  == Changelog ==
137
 
 
 
 
138
  = 2.0.6 =
139
  * (18 Sep 2013) Added Portuguese translation.
140
 
@@ -192,6 +195,9 @@ Setting bulk discounts couldn't have been easier.
192
 
193
  == Upgrade Notice ==
194
 
 
 
 
195
  = 2.0.6 =
196
  Minor maintenance release.
197
 
4
  Tags: woocommerce, bulk, discount
5
  Requires at least: 3.5
6
  Tested up to: 3.6
7
+ Stable tag: 2.0.7
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
40
 
41
  * Possibility of setting percentage bulk discount or flat (fixed) bulk discount in currency units.
42
  * Bulk discount for product variations supported to treat them as a whole when discounting.
43
+ * Discount is better visible and is present on several locations (see below).
44
  * Discount is visible on Checkout page
45
  * Discount is visible on Order Details page
46
  * Discount is visible in WooCommerce order e-mails and invoice as well.
135
 
136
  == Changelog ==
137
 
138
+ = 2.0.7 =
139
+ * (29 Sep 2013) Added configuration on which locations should the discount information be visible.
140
+
141
  = 2.0.6 =
142
  * (18 Sep 2013) Added Portuguese translation.
143
 
195
 
196
  == Upgrade Notice ==
197
 
198
+ = 2.0.7 =
199
+ Release with new features.
200
+
201
  = 2.0.6 =
202
  Minor maintenance release.
203
 
woocommerce-bulk-discount.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WooCommerce Bulk Discount
4
  Plugin URI: http://www.tools4me.net/wordpress/woocommerce-bulk-discount-plugin
5
  Description: Apply fine-grained bulk discounts to items in the shopping cart.
6
  Author: Rene Puchinger
7
- Version: 2.0.6
8
  Author URI: http://www.renepuchinger.com
9
  License: GPL3
10
 
@@ -140,6 +140,9 @@ if (!class_exists('Woo_Bulk_Discount_Plugin_t4m')) {
140
  public function filter_item_price($price, $values)
141
  {
142
  global $woocommerce;
 
 
 
143
  if ((get_option('woocommerce_t4m_discount_type', '') == 'flat')) {
144
  return $price; // for flat discount this filter has no meaning
145
  }
@@ -172,6 +175,9 @@ if (!class_exists('Woo_Bulk_Discount_Plugin_t4m')) {
172
  public function filter_subtotal_price($price, $values)
173
  {
174
  global $woocommerce;
 
 
 
175
  $_product = $values['data'];
176
  if (empty($this->discount_coeffs) || !isset($this->discount_coeffs[$this->get_actual_id($_product)])
177
  || !isset($this->discount_coeffs[$this->get_actual_id($_product)]['orig_price']) || !isset($this->discount_coeffs[$this->get_actual_id($_product)]['coeff'])
@@ -231,6 +237,9 @@ if (!class_exists('Woo_Bulk_Discount_Plugin_t4m')) {
231
  public function filter_subtotal_order_price($price, $values, $order)
232
  {
233
  global $woocommerce;
 
 
 
234
  $_product = get_product($values['product_id']);
235
  $actual_id = $values['product_id'];
236
  if ($_product && $_product instanceof WC_Product_Variable && $values['variation_id']) {
@@ -609,6 +618,32 @@ if (!class_exists('Woo_Bulk_Discount_Plugin_t4m')) {
609
  'default' => 'yes'
610
  ),
611
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  array(
613
  'name' => __('Optionally enter information about discounts visible on cart page.', 'wc_bulk_discount'),
614
  'id' => 'woocommerce_t4m_cart_info',
@@ -647,7 +682,7 @@ if (!class_exists('Woo_Bulk_Discount_Plugin_t4m')) {
647
  $js = "
648
  jQuery('#woocommerce_t4m_enable_bulk_discounts').change(function(){
649
 
650
- jQuery('#woocommerce_t4m_cart_info, #woocommerce_t4m_variations_separate, #woocommerce_t4m_discount_type, #woocommerce_t4m_css_old_price, #woocommerce_t4m_css_new_price').closest('tr').hide();
651
 
652
  if ( jQuery(this).attr('checked') ) {
653
  jQuery('#woocommerce_t4m_cart_info').closest('tr').show();
@@ -655,6 +690,9 @@ if (!class_exists('Woo_Bulk_Discount_Plugin_t4m')) {
655
  jQuery('#woocommerce_t4m_discount_type').closest('tr').show();
656
  jQuery('#woocommerce_t4m_css_old_price').closest('tr').show();
657
  jQuery('#woocommerce_t4m_css_new_price').closest('tr').show();
 
 
 
658
  }
659
 
660
  }).change();
4
  Plugin URI: http://www.tools4me.net/wordpress/woocommerce-bulk-discount-plugin
5
  Description: Apply fine-grained bulk discounts to items in the shopping cart.
6
  Author: Rene Puchinger
7
+ Version: 2.0.7
8
  Author URI: http://www.renepuchinger.com
9
  License: GPL3
10
 
140
  public function filter_item_price($price, $values)
141
  {
142
  global $woocommerce;
143
+ if ((get_option('woocommerce_t4m_show_on_item', 'yes') == 'no')) {
144
+ return $price;
145
+ }
146
  if ((get_option('woocommerce_t4m_discount_type', '') == 'flat')) {
147
  return $price; // for flat discount this filter has no meaning
148
  }
175
  public function filter_subtotal_price($price, $values)
176
  {
177
  global $woocommerce;
178
+ if ((get_option('woocommerce_t4m_show_on_subtotal', 'yes') == 'no')) {
179
+ return $price;
180
+ }
181
  $_product = $values['data'];
182
  if (empty($this->discount_coeffs) || !isset($this->discount_coeffs[$this->get_actual_id($_product)])
183
  || !isset($this->discount_coeffs[$this->get_actual_id($_product)]['orig_price']) || !isset($this->discount_coeffs[$this->get_actual_id($_product)]['coeff'])
237
  public function filter_subtotal_order_price($price, $values, $order)
238
  {
239
  global $woocommerce;
240
+ if ((get_option('woocommerce_t4m_show_on_order_subtotal', 'yes') == 'no')) {
241
+ return $price;
242
+ }
243
  $_product = get_product($values['product_id']);
244
  $actual_id = $values['product_id'];
245
  if ($_product && $_product instanceof WC_Product_Variable && $values['variation_id']) {
618
  'default' => 'yes'
619
  ),
620
 
621
+ array(
622
+ 'name' => __('Show discount information next to cart item price', 'wc_bulk_discount'),
623
+ 'id' => 'woocommerce_t4m_show_on_item',
624
+ 'desc' => __('Applies only to percentage discount.', 'wc_bulk_discount'),
625
+ 'std' => 'yes',
626
+ 'type' => 'checkbox',
627
+ 'default' => 'yes'
628
+ ),
629
+
630
+ array(
631
+ 'name' => __('Show discount information next to item subtotal price', 'wc_bulk_discount'),
632
+ 'id' => 'woocommerce_t4m_show_on_subtotal',
633
+ 'std' => 'yes',
634
+ 'type' => 'checkbox',
635
+ 'default' => 'yes'
636
+ ),
637
+
638
+ array(
639
+ 'name' => __('Show discount information next to item subtotal price in order history', 'wc_bulk_discount'),
640
+ 'id' => 'woocommerce_t4m_show_on_order_subtotal',
641
+ 'desc' => __('Includes showing discount in order e-mails and invoices.', 'wc_bulk_discount'),
642
+ 'std' => 'yes',
643
+ 'type' => 'checkbox',
644
+ 'default' => 'yes'
645
+ ),
646
+
647
  array(
648
  'name' => __('Optionally enter information about discounts visible on cart page.', 'wc_bulk_discount'),
649
  'id' => 'woocommerce_t4m_cart_info',
682
  $js = "
683
  jQuery('#woocommerce_t4m_enable_bulk_discounts').change(function(){
684
 
685
+ jQuery('#woocommerce_t4m_cart_info, #woocommerce_t4m_variations_separate, #woocommerce_t4m_discount_type, #woocommerce_t4m_css_old_price, #woocommerce_t4m_css_new_price, #woocommerce_t4m_show_on_item, #woocommerce_t4m_show_on_subtotal, #woocommerce_t4m_show_on_order_subtotal').closest('tr').hide();
686
 
687
  if ( jQuery(this).attr('checked') ) {
688
  jQuery('#woocommerce_t4m_cart_info').closest('tr').show();
690
  jQuery('#woocommerce_t4m_discount_type').closest('tr').show();
691
  jQuery('#woocommerce_t4m_css_old_price').closest('tr').show();
692
  jQuery('#woocommerce_t4m_css_new_price').closest('tr').show();
693
+ jQuery('#woocommerce_t4m_show_on_item').closest('tr').show();
694
+ jQuery('#woocommerce_t4m_show_on_subtotal').closest('tr').show();
695
+ jQuery('#woocommerce_t4m_show_on_order_subtotal').closest('tr').show();
696
  }
697
 
698
  }).change();