• Hello,

    we are using a wordpress plugin called Checkout Field Editor for WooCommerce, to add an addtional note (text) field on the checkout page. we wanted to call that data on the order note PDF file can you let us know how that can be done.

Viewing 5 replies - 1 through 5 (of 5 total)
  • moksha shah

    (@mokshasharmila13)

    Hi @crusin316

    For adding custom fields in our invoice, please add the below code in your active theme’s functions.php file or use a plugin like Code Snippets:

    function example_custom_order_fields( $fields, $order ) {
        $new_fields = array();
    
        if( get_post_meta( $order->get_id(), 'your_meta_field_name', true ) ) {
            $new_fields['your_meta_field_name'] = array( 
                'label' => 'VAT',
                'value' => get_post_meta( $order->get_id(), 'your_meta_field_name', true )
            );
        }
    
        if( get_post_meta( $order->get_id(), 'your_meta_field_name', true ) ) {
            $new_fields['your_meta_field_name'] = array( 
                'label' => 'Customer Number',
                'value' => get_post_meta( $order->get_id(), 'your_meta_field_name', true )
            );
        }
    
        return array_merge( $fields, $new_fields );
    }
    add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields', 10, 2 );
    

    Please let us know if you have any other query.

    Regards,Moksha.

    Thread Starter crusin316

    (@crusin316)

    Hey I want the custom field to appear on the order note pdf and not the invoice.

    moksha shah

    (@mokshasharmila13)

    Hi @crusin316

    You can add the custom fields in order note pdf also with this code. Try this code and let us know.

    Please let us know if you need any other help.

    Regards, Moksha.

    Thread Starter crusin316

    (@crusin316)

    i did try its now showing up.

    moksha shah

    (@mokshasharmila13)

    Hi @crusin316

    You worked with this code and now your custom field is been displayed in order note pdf, right ?

    Regards,Moksha.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to Add custom checkout fields to order delivery note’ is closed to new replies.