Custom Fields Not Outputting to Invoice & Packing Slip
-
I followed this thread to try to output custom checkout fields Cost Center and Purchase Order, but it’s not working for me.
I used the Woocommerce Checkout Manager plugin to create 3 new fields on the checkout page, and I want to output those 3 new field labels and their contents on the invoices and packing slips creted by the WooCommerce PDF Invoices & Packing Slips plugin. The following link shows what the 3 fields look like after being created using the Woocommerce Checkout Manager plugin.
I copied all the template files to my child theme. Then I entered the following code into the NEW copy of the “Simple” template, after the order details and before the footer.
<?php $myfield1 = get_post_meta($wpo_wcpdf->export->order->id,'Purchase Order:',true); if (isset($myfield1)) { echo 'Purchase Order:',$myfield1; } ?> <?php $myfield2 = get_post_meta($wpo_wcpdf->export->order->id,'Cost Center:',true); if (isset($myfield2)) { echo 'Cost Center: ',$myfield2; } ?> <?php $myfield3 = get_post_meta($wpo_wcpdf->export->order->id,'Embroidery:',true); if (isset($myfield3)) { echo 'Embroidery: ',$myfield3; } ?>
The following link shows the result. Basically the labels for the 3 new fields are being output all in row instead of one on each line. And the values of the 3 new fields aren’t being output at all.
How do I make the field labels output on separate lines, and how do I make the field values output beside their respective labels? I’m thinking I need to make a table with 2 columns and 3 rows, but I’m not sure how to fit the above code into a table like that. Suggestions? Thanks for your time.
https://www.ads-software.com/plugins/woocommerce-pdf-invoices-packing-slips/
- The topic ‘Custom Fields Not Outputting to Invoice & Packing Slip’ is closed to new replies.