• Hi,

    I am using this plugin for my website. I have used hook to add a custom field “Additional Info” which will will allow to leave some details that they want during the shipping. But, Problem is that the changes are not reflected in backend. ie when user fills this field and orders any product, in backend it is not reflected in “Customer Note:” section.
    Any help will be much appreciated. Also, is there any way to display “Customer Note:” section on frontend while checkout, so that there is no need to add hooks

    add_action('woocommerce_after_checkout_billing_form', 'my_custom_checkout_field');
    
    function my_custom_checkout_field( $checkout ) {
    
        woocommerce_form_field( 'my_field_name', array(
            'type'          => 'textarea',
            'class'         => array('form-row-first'),
            'label'         => __('Comments'),
            'placeholder'       => __('Enter something'),
            ), $checkout->get_value( 'my_field_name' ));
    
    } 
    
    add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta');
    
    function my_custom_checkout_field_update_order_meta( $order_id ) {
        if ($_POST['my_field_name']) update_post_meta( $order_id, 'My Field', esc_attr($_POST['my_field_name']));
    }

    http://wordpress.org/extend/plugins/woocommerce/

  • The topic ‘Need to add "Additional Info" field during checkout (’ is closed to new replies.