I want to add order status in print page using Invoice & Delivery Notes for WooCommerce plugin I tried this code and it didn't work, what is the problem? my code :
function add_order_status( $fields, $order ) {
$new_fields = array();
if( get_post_meta( $order->get_status(), 'order-status', true ) ) {
$new_fields['order-status'] = array(
'label' => 'Order Status',
'value' => get_post_meta( $order->get_status(), 'order-status', true )
);
}
return array_merge( $fields, $new_fields );
}
add_filter( 'wcdn_order_info_fields', 'add_order_status', 10, 2 );
You were very close to the correct code snippet. Please find the correct code below.
function bks_add_extra_field( $fields, $order ) {
$new_fields = array();
if( $order->get_status() ) {
$new_fields['status'] = array(
'label' => 'Order Status',
'value' => $order->get_status(),
);
}
return array_merge( $fields, $new_fields );
}
add_filter( 'wcdn_order_info_fields', 'bks_add_extra_field', 10, 2 );
For anyone else who is looking to customize Invoice & Delivery Notes for WooCommerce plugin you can find the list of all the hooks here: