WooCommerce PDF Invoices & Packing Slips - Version 1.2.9

Version Description

  • Fix: bug where 'standard' tax class would not display in some cases
  • Fix: bug that caused the totals to jump for some font sizes
  • Fix: WC2.1 deprecated totals function
  • Fix: If multiple taxes were set up with the same name, only one would display (Simple template was not affected)
Download this release

Release Info

Developer pomegranate
Plugin Icon 128x128 WooCommerce PDF Invoices & Packing Slips
Version 1.2.9
Comparing to
See all releases

Code changes from version 1.2.8 to 1.2.9

includes/class-wcpdf-export.php CHANGED
@@ -476,11 +476,15 @@ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Export' ) ) {
476
  * @return string $tax_rates imploded list of tax rates
477
  */
478
  public function get_tax_rate( $tax_class, $line_total, $line_tax ) {
479
- if (empty($tax_class))
480
- $tax_class = 'standard';
481
-
482
  if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
483
  // WC 2.1 or newer is used
 
 
 
 
 
 
 
484
  $tax = new WC_Tax();
485
  $taxes = $tax->get_rates( $tax_class );
486
 
@@ -488,8 +492,14 @@ if ( ! class_exists( 'WooCommerce_PDF_Invoices_Export' ) ) {
488
  $tax_rates[$tax['label']] = round( $tax['rate'], 2 ).'%';
489
  }
490
 
491
- if (empty($tax_rates))
492
- $tax_rates = (array) '-';
 
 
 
 
 
 
493
 
494
  $tax_rates = implode(' ,', $tax_rates );
495
  } else {
476
  * @return string $tax_rates imploded list of tax rates
477
  */
478
  public function get_tax_rate( $tax_class, $line_total, $line_tax ) {
 
 
 
479
  if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
480
  // WC 2.1 or newer is used
481
+ if ( $line_tax == 0 ) {
482
+ return '-'; // no need to determine tax rate...
483
+ }
484
+
485
+ // if (empty($tax_class))
486
+ // $tax_class = 'standard';// does not appear to work anymore - get_rates does accept an empty tax_class though!
487
+
488
  $tax = new WC_Tax();
489
  $taxes = $tax->get_rates( $tax_class );
490
 
492
  $tax_rates[$tax['label']] = round( $tax['rate'], 2 ).'%';
493
  }
494
 
495
+ if (empty($tax_rates)) {
496
+ // one last try: manually calculate
497
+ if ( $line_total != 0) {
498
+ $tax_rates = round( ($line_tax / $line_total)*100, 1 ).'%';
499
+ } else {
500
+ $tax_rates = (array) '-';
501
+ }
502
+ }
503
 
504
  $tax_rates = implode(' ,', $tax_rates );
505
  } else {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: pomegranate
3
  Tags: woocommerce, print, pdf, bulk, packing slips, invoices, delivery notes, invoice, packing slip, export, email
4
  Requires at least: 3.5 and WooCommerce 2.0
5
  Tested up to: 3.8.1 and WooCommerce 2.1
6
- Stable tag: 1.2.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -136,6 +136,25 @@ function wpo_wcpdf_myaccount_allowed_order_statuses( $allowed_statuses ) {
136
  }
137
  `
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  = Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ### bytes) =
140
 
141
  This usually only happens on batch actions. PDF creation is a memory intensive job, especially if it includes several pages with images. Go to WooCommerce > System Status to check your WP Memory Limit. We recommend setting it to 128mb or more.
@@ -149,6 +168,12 @@ This usually only happens on batch actions. PDF creation is a memory intensive j
149
 
150
  == Changelog ==
151
 
 
 
 
 
 
 
152
  = 1.2.8 =
153
  * Template: Body line-height defined to prevent character jumping with italic texts
154
  * Fix: Open Sans now included in plugin package (fixes font issues for servers with allow_url_fopen disabled)
3
  Tags: woocommerce, print, pdf, bulk, packing slips, invoices, delivery notes, invoice, packing slip, export, email
4
  Requires at least: 3.5 and WooCommerce 2.0
5
  Tested up to: 3.8.1 and WooCommerce 2.1
6
+ Stable tag: 1.2.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
136
  }
137
  `
138
 
139
+ = How can I get a copy of the invoice emailed to the shop manager? =
140
+ The easiest way to do this is to just tick the 'new order' box. However, this also means that an invoice will be created for all new orders, also the ones that are never completed.
141
+
142
+ Alternatively you can get a (BCC) copy of the completed order email by placing the following filter in your theme's `functions.php` (Some themes have a "custom functions" area in the settings)
143
+ Modify the name & email address to your own preferences,
144
+
145
+ `
146
+ add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
147
+
148
+ function mycustom_headers_filter_function( $headers, $object ) {
149
+ if ($object == 'customer_completed_order') {
150
+ $headers .= 'BCC: Your name <your@email.com>' . "\r\n"; //just repeat this line again to insert another email address in BCC
151
+ }
152
+
153
+ return $headers;
154
+ }
155
+ `
156
+
157
+
158
  = Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ### bytes) =
159
 
160
  This usually only happens on batch actions. PDF creation is a memory intensive job, especially if it includes several pages with images. Go to WooCommerce > System Status to check your WP Memory Limit. We recommend setting it to 128mb or more.
168
 
169
  == Changelog ==
170
 
171
+ = 1.2.9 =
172
+ * Fix: bug where 'standard' tax class would not display in some cases
173
+ * Fix: bug that caused the totals to jump for some font sizes
174
+ * Fix: WC2.1 deprecated totals function
175
+ * Fix: If multiple taxes were set up with the same name, only one would display (Simple template was not affected)
176
+
177
  = 1.2.8 =
178
  * Template: Body line-height defined to prevent character jumping with italic texts
179
  * Fix: Open Sans now included in plugin package (fixes font issues for servers with allow_url_fopen disabled)
templates/pdf/Simple/invoice.php CHANGED
@@ -94,7 +94,7 @@
94
  <tr>
95
  <td class="no-borders">&nbsp;</td>
96
  <th class="description"><?php echo $total['label']; ?></th>
97
- <td class="price"><?php echo $total['value']; ?></td>
98
  </tr>
99
  <?php endforeach; ?>
100
  </tfoot>
94
  <tr>
95
  <td class="no-borders">&nbsp;</td>
96
  <th class="description"><?php echo $total['label']; ?></th>
97
+ <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td>
98
  </tr>
99
  <?php endforeach; ?>
100
  </tfoot>
woocommerce-pdf-invoices-packingslips.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
  * Plugin URI: http://www.wpovernight.com
5
  * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
- * Version: 1.2.8
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
@@ -438,8 +438,8 @@ if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
438
  public function get_order_taxes() {
439
  $tax_label = __( 'VAT', 'wpo_wcpdf' ); // register alternate label translation
440
  if ($this->export->order->get_taxes()) {
441
- foreach ( $this->export->order->get_taxes() as $tax ) {
442
- $taxes[ sanitize_title( $tax[ 'name' ] ) ] = array(
443
  'label' => isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ],
444
  'value' => woocommerce_price( ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] ) )
445
  );
@@ -461,10 +461,10 @@ if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
461
 
462
  if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
463
  // WC 2.1 or newer is used
464
- $total_unformatted = $this->export->order->get_order_total();
465
  } else {
466
  // Backwards compatibility
467
- $total_unformatted = $this->export->order->get_total();
468
  }
469
 
470
  $total = woocommerce_price( ( $total_unformatted - $total_tax ) );
3
  * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
  * Plugin URI: http://www.wpovernight.com
5
  * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
+ * Version: 1.2.9
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
438
  public function get_order_taxes() {
439
  $tax_label = __( 'VAT', 'wpo_wcpdf' ); // register alternate label translation
440
  if ($this->export->order->get_taxes()) {
441
+ foreach ( $this->export->order->get_taxes() as $key => $tax ) {
442
+ $taxes[ $key ] = array(
443
  'label' => isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ],
444
  'value' => woocommerce_price( ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] ) )
445
  );
461
 
462
  if ( version_compare( WOOCOMMERCE_VERSION, '2.1' ) >= 0 ) {
463
  // WC 2.1 or newer is used
464
+ $total_unformatted = $this->export->order->get_total();
465
  } else {
466
  // Backwards compatibility
467
+ $total_unformatted = $this->export->order->get_order_total();
468
  }
469
 
470
  $total = woocommerce_price( ( $total_unformatted - $total_tax ) );