bfeeee
Forum Replies Created
-
Hi, Ewout!
I’m very grateful for Your answer, it helped! In the end made something like this
add_filter( 'wpo_wcpdf_woocommerce_totals', 'wpo_wcpdf_woocommerce_totals_custom', 10, 2); function wpo_wcpdf_woocommerce_totals_custom( $totals, $order) { $totals = array( 'price_without_vat' => array( 'label' => __('Price without VAT', 'wpo_wcpdf'), 'value' => wc_price( $order->get_total() - $order->get_total_tax(), array( 'currency' => WPO_WCPDF()->export->order->get_order_currency() ) ), ), 'order_shipping' => array( 'label' => __('Shipping', 'arga-custom'), //Can't find the function/variable to show shipping AND/OR is shipping even selected 'value' => '', ), 'total_tax' => array( 'label' => __('Total tax', 'wpo_wcpdf'), 'value' => wc_price( WPO_WCPDF()->export->order->get_total_tax() - WPO_WCPDF()->export->order->get_total_tax_refunded(), array( 'currency' => WPO_WCPDF()->export->order->get_order_currency() ) ), ), 'total_price' => array( 'label' => __('Total price', 'wpo_wcpdf'), 'value' => wc_price( $order->get_total(), array( 'currency' => WPO_WCPDF()->export->order->get_order_currency() ) ), ), // etc. ); return $totals; }
but there is problem with shipping, somehow I can’t understand how to show shipping (if shipping even is selected).
Tried adding get_order_shipping + changing add_filter to accept 3 variables and adding $tax variable, but it didn’t work.
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Display Cost of each item?After a little bit tinkering here is the solution. I just made my own template copying everything from existing
1. plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/{your template name}/invoice.php
2. Add new table rows<thead> <tr> <th class="product"><?php _e('Product', 'wpo_wcpdf'); ?></th> <th class="quantity"><?php _e('Quantity', 'wpo_wcpdf'); ?></th> <th class="price"><?php _e('Product price without VAT', 'wpo_wcpdf'); ?></th> <th class="price"><?php _e('Product prices VAT', 'wpo_wcpdf'); ?></th> <th class="price"><?php _e('Price including VAT', 'wpo_wcpdf'); ?></th> </tr> </thead>
3. Next find <td class=”price”><?php echo $item[‘order_price’]; ?></td> and replace it with
<td class="price"><?php echo $item['line_total']; ?></td> <!-- line total (line without VAT/TAX) --> <td class="line-tax"><?php echo $item['line_tax']; ?></td> <!-- line tax (only VAT/TAX) --> <td class="price"><?php echo $item['order_price']; ?></td> <!-- Price total with VAT/TAX (single line) -->
And that’s all.
Hope it helps.
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Display Cost of each item?How to do it WITHOUT BUYING (Professional) or Premium Templates extension?
I presume it could be simple, if only knew the right variable. Something like this?
<th class=”price”>’); ?><?php _e(‘Price’, ‘wpo_wcpdf</th>