Add custom field to invoice
-
Hi, I'm using this plugin to add custom fields "WooCommerce Checkout Manager" and I've added to the checkout billing fields a few custom fields that show the name of the company, company ID, and 2 other fields. I want those fields to be displayed in the Invoice, but the only output I'm getting is the Label, and the values are not shown.? All the custom fields are hidden until the answer to a previous question is yes, but in my testing the answer in the order was yes and all the custom fields were fulfilled. In that case I would like also to know if it's possible to hide those fields in the invoice if the answer is No or if the fields are empty. This is the code I'm using:
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_service_charge', 10, 2 ); function wpo_wcpdf_service_charge ($template_type, $order) { ?> <tr class="billing_wooccm13"> <th>Company:</th> <td><?php $order->get_meta('billing_wooccm13'); ?></td> </tr> <?php } add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_service_charge', 10, 2 ); function wpo_wcpdf_service_charge ($template_type, $order) { ?> <tr class="billing_wooccm10"> <th>Company ID:</th> <td><?php $order->get_meta('billing_wooccm10'); ?></td> </tr> <?php } add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_service_charge', 10, 2 ); function wpo_wcpdf_service_charge ($template_type, $order) { ?> <tr class="billing_wooccm11"> <th>SSa:</th> <td><?php $order->get_meta('billing_wooccm11'); ?></td> </tr> <?php } add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_service_charge', 10, 2 ); function wpo_wcpdf_service_charge ($template_type, $order) { ?> <tr class="billing_wooccm12"> <th>SSb:</th> <td><?php $order->get_meta('billing_wooccm12'); ?></td> </tr> <?php }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add custom field to invoice’ is closed to new replies.