diff --git a/wordpress-plugin-woocommerce-purchase-order.php b/wordpress-plugin-woocommerce-purchase-order.php
index 3d0439e..44e3b82 100644
--- a/wordpress-plugin-woocommerce-purchase-order.php
+++ b/wordpress-plugin-woocommerce-purchase-order.php
@@ -70,7 +70,7 @@
'value' => get_post_meta($order->id, $field, TRUE),
);
return $email_fields;
-});
+}, 10, 3);
add_action('woocommerce_admin_order_data_after_order_details', function ($order) use ($fields, $order_details_label) {
foreach ($fields as $field => $def)
@@ -87,3 +87,15 @@
if ($s)
printf('
', $s);
},5);
+
+// Also add the field to the PDF invoice/packing-slip if the plugin is available.
+// See http://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/pdf-template-action-hooks/
+add_action('wpo_wcpdf_after_order_data', function ($template_type, $order) use ($fields) {
+ foreach ($fields as $field => $def)
+ if ($value = get_post_meta($order->id, $field, TRUE))
+ printf('%s: | %s | |
', esc_html($def['label']), esc_html($value));
+}, 10, 2);
+
+add_action('wpo_wcpdf_before_item_meta', function ($template_type, $item, $order) {
+ printf('- %s:
%s
', 'Unit Price', $item['ex_single_price']);
+}, 10, 3);