'Save Order item custom field in Woocommerce Admin order pages

I have add custom fields in back office order for each line products : Image
(source: com-pac.ovh)

My code:


add_action( 'woocommerce_before_order_itemmeta', 'cfwc_create_custom_field' );
function cfwc_create_custom_field() {

    $args = array(
        'id' => 'custom_text_field_title',
        'label' => __( 'Custom Text Field Title', 'cfwc' ),
        'class' => 'cfwc-custom-field',
        'desc_tip' => true,
        'description' => __( 'Enter the title of your custom text field.', 'ctwc' ),
    );

    woocommerce_wp_text_input( $args );
}

My problem is that I don't know how to save this fields.

Any help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source