Hi @gamethrall,
Thank you for appreciating our plugin.
Regarding the query, can you please inform us which plugin are you using for purchasing the orders? Also, it would be great if you can ask the plugin authors about how we can fetch PO numbers from the order information.
This information will be helpful to assist you in a better way.
Regards,
Kenil Shah
The plugin I am using is called Purchase Orders for WooCommerce (https://wordpress.org/plugins/purchase-orders-for-woocommerce/). I reached out to them a few days ago regarding the field information. When they respond, I’ll let you know. Thanks!
James Bumgarner
Hi @gamethrall,
Thank you for sharing the plugin name and the link.
Please let us know once you hear from them.
Regards,
Kenil Shah
Hi @kenil802
The plugin author says that the field is called “_purchase_order_number” and is part of the regular post meta from the order.
From a search I did, I found this code which I thought was supposed to display the purchase order number, but it is not.
function add_purchase_order_to_invoice_slip( $fields, $order ) {
$new_fields = array();
if( get_post_meta( $order->id, '_purchase_order_number', true ) ) {
$new_fields['_purchase_order_number'] = array(
'label' => 'Purchase Order Number',
'value' => get_post_meta( $order->id, '_purchase_order_number', true )
);
}
return array_merge( $fields, $new_fields );
}
add_filter( 'wcdn_order_info_fields', ' add_purchase_order_to_invoice_slip', 10, 2 );
Hi @gamethrall,
Thank you for the details.
Can you please try by replicating the $order->id with $order->get_id() and check with it is solving the issue or not.
Please let us know how it goes.
Regards,
Kenil Shah
@kenil802
That did it! (That and removing an extraneous space from add_filter that was preventing the entire block from loading). Thank you so much!
James
Hi @gamethrall,
I am glad that the provided solution worked for you and it is working fine on your site.
Please let us know if you have further queries.
Regards,
Kenil Shah