Snippet to Show PO Number On Order Details
-
Hello!
I am wondering if you can send a snippet that will show the PO Number on the Order Details Page in the Customer’s “My Account” Orders.
IMPORTANT NOTE: I’m using the following snippet that you previously sent that shows the PO Number in the order list and Thank You Page. This is working great!
(Is it possible to show PO Number column only for a customer that has a PO rather than to all customers?)// Add PO Number Column on My Orders Table add_action( 'woocommerce_my_account_my_orders_column_po-number' , 'add_igfw_po_number',10,1 ); function add_igfw_po_number( $order ) { $po_number = get_post_meta( $order->get_id(), 'igfw_purchase_order_number', true ); echo $po_number; } add_filter( 'woocommerce_account_orders_columns', 'new_orders_columns',10,1 ); function new_orders_columns( $columns) { // Add new column. Kept simple to play nice with other filters. $columns['po-number'] = __( 'PO Number', 'woocommerce' ); return $columns; } // Add PO Number on Thank You Page add_action('woocommerce_thankyou_igfw_invoice_gateway', 'igfw_show_po_number_on_thank_you_page', 10, 1); function igfw_show_po_number_on_thank_you_page($order_id) { $order = wc_get_order($order_id); $po_number = $order->get_meta('igfw_purchase_order_number', true); echo '<p><strong>PO Number:</strong> ' . $po_number . '</p>'; }
Thanks for your help!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Snippet to Show PO Number On Order Details’ is closed to new replies.