Plugin Contributor
kluver
(@kluver)
Hi @frankred933,
That is all certainly possible. You will need our Premium Templates extension for that. This will give you access to the customizer that will let you add extra columns, totals and custom fields to your documents.
Thank you for this information, but I got it working without premium templates extension.
This is my code for the invoice table:
<?php
$templater = WPI()->templater();
$order = $templater->order;
// Get cart items
$items = $order->get_items();
?>
<table>
<thead>
<tr>
<th>SKU</th>
<th>Quantity</th>
<th>Litre</th>
<th>Name</th>
<th>Single price<br/>EUR</th>
<th>Total price<br/>EUR</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $items as $item ) {
$product_name = $item->get_name();
$product_id = $item->get_product_id();
$product_variation_id = $item->get_variation_id();
$product = wc_get_product( $product_id );
$sku = $product->get_sku();
?>
<tr>
<td><?php if($sku){ echo $sku; } else { echo '-'; } ?></td>
<td><?php echo wp_kses_post( apply_filters( 'woocommerce_email_order_item_quantity', $item->get_quantity(), $item ) ); ?></td>
<td><?php echo get_field('liter', $product->get_id()) ?></td>
<td><?php echo $product->get_name(); ?></td>
<td><?php echo wc_price( $order->get_item_total( $item, true, true ), array( 'currency' => $order->get_order_currency() ) ); ?></td>
<td><?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?></td>
</tr>
<?php } ?>
<?php
foreach ( $invoice->get_order_item_totals() as $key => $total ) {
$class = str_replace( '_', '-', $key );
?>
<tr>
<td> </td>
<td> </td>
<td><?php do_action( 'wpi_order_item_totals_left', $key, $invoice ); ?> </td>
<td><?php echo $total['label']; ?></td>
<td> </td>
<td><?php echo str_replace( ' ', '', $total['value'] ); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
-
This reply was modified 7 years, 7 months ago by
frankred933.
-
This reply was modified 7 years, 7 months ago by
frankred933.
-
This reply was modified 7 years, 7 months ago by
frankred933.
-
This reply was modified 7 years, 7 months ago by
frankred933.