• Resolved igiaki

    (@igiaki)


    Hi,
    I am using your plugin for printing delivery notes.
    However, during the checkout I have added a singole custom field. This was done by using the plugin ‘Checkout Manager’. I need that field in the printed note, so I add the following code to the function.php of my theme:

    (wooccm0 is the name of the new field)

    function example_custom_order_fields( $fields, $order ) {
        $new_fields = array();
            
        if( get_post_meta( $order->id, 'wooccm0', true ) ) {
            $new_fields['wooccm0'] = array( 
                'label' => 'Codice ISS',
                'value' => get_post_meta( $order->id, 'wooccm0', true )
            );
        }
        
        return array_merge( $fields, $new_fields );
    }
    add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields', 10, 1 );

    However, when I print the order I am still not able to see the new field.
    How can I do?

    Thanks for help

    • This topic was modified 3 years, 11 months ago by igiaki.
    • This topic was modified 3 years, 11 months ago by igiaki.
    • This topic was modified 3 years, 11 months ago by igiaki. Reason: formatting
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support kenil802

    (@kenil802)

    Hi @igiaki,

    Sorry for the delay in response.

    Thank you for sharing the code.

    Regarding the query, the field should be a custom meta field to add a new field.

    Please let us know if you have any further queries.

    Regards,
    Kenil Shah

    Sou leigo no assunto, poderia me ajudar a implantar mais campos na nota de entrega?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add custom field from checkout manager plugin’ is closed to new replies.