• Resolved konnox

    (@konnox)


    Hello, I have a question about the information that appears, I need to appear on the printed invoice two additional fields made by custom fields checkout, is it possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @konnox,

    Yes, it is possible to add the custom fields values to the Print Invoice. We do provide hooks which can be used to add the value of the custom field.

    Please use the ‘wcdn_order_info_fields’ hook in the functions.php file of the theme which is currently active on your site.

    Let me know if you have any further queries.

    Regards,
    Komal Maru

    Could you please give me the hook syntax to add extra fields?

    Iam Noob 🙁

    Hi @konnox,

    Please find the below sample example which you can use to print the custom extra field on the Print Invoice.

    add_filter( 'wcdn_order_info_fields', 'wcdn_order_info_fields_function', 10, 2 );
    public static function wcdn_order_info_fields_function( $fields, $order ) {
    	$new_fields = array();
                   
            $locations_label = "Your Custom label";
            $output = "Your custom data which you want to output";
    	$new_fields[ $locations_label ] = array(
                    'label' => $locations_label,
                    'value' => $output 
            );
    		
    	return array_merge( $fields, $new_fields );	
    }

    I hope the provided sample example helps you to add the custom fields to the Invoices template. Let me know if you need any further assistance.

    Regards,
    Komal Maru

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.