Using the Plugin by Ewout Fernhout, WooCommerce PDF Invoices & Packing Slips, you might want to add the shipping information in the field reserved for the shipping price.
To do so, you just have to override the template file invoice.php located inside the plugin’s template folder.
Copy it and place it inside your theme folder under woocommerce/pdf/<yourtemplate>/invoice.php
(the <yourtemplate> part you can define yourself and set it in the plugin’s settings where it says “Choose a template”)
Now all you have to do is
Change this:
<?php foreach( $this->get_woocommerce_totals() as $key => $total ) : ?> <tr class="<?php echo $key; ?>"> <td class="no-borders"></td> <th class="description"><?php echo $total['label']; ?></th> <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td> </tr> <?php endforeach; ?>
Into this:
<?php foreach( $this->get_woocommerce_totals() as $key => $total ) : ?> <tr class="<?php echo $key; ?>"> <td class="no-borders"></td> <th class="description"><?php echo $total['label']; ?></th> <td class="price"> <?php if ( $key == 'shipping' ) { echo $order->get_shipping_method() . "<br/>"; } if ( !($key == 'shipping' && ($total['value'] == 0)) ) { ?> <span class="totals-price"><?php echo $total['value']; ?></span> <?php } ?> </td> </tr> <?php endforeach; ?>
Leave a Reply