Support » Plugin: Print Invoice & Delivery Notes for WooCommerce » add custom field to print area

  • Resolved Mohannad Najjar

    (@ma7aba-star)


    hi
    i make custom fields to my checkout page
    and i need to show this fields in my order print area
    how i can do it ?!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Upendra Kapse

    (@wpupen)

    Hi @ma7aba-star,

    First of all, apologies for the delay in getting back to you on this.

    We do have a filter using which you can add a custom field to the Invoice using the meta key of that field. Here’s an example code snippet that will help you do this:

    function example_custom_order_fields( $fields, $order ) {
        $new_fields = array();
            
        if( get_post_meta( $order->id, 'your_meta_field_name', true ) ) {
            $new_fields['your_meta_field_name'] = array( 
                'label' => 'VAT',
                'value' => get_post_meta( $order->id, 'your_meta_field_name', true )
            );
        }
        
     
        return array_merge( $fields, $new_fields );
    }
    add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields', 10, 2 );
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.