• Hi everyone

    I have entered a new field (shipping phone), when an order arrives it is inserted and I visualize it correctly, but when I have to manually insert an order I cannot insert it or edit it. how can I do ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @dimaregabriele!

    It sound like you added the custom field/s correctly, but if you need it also showing in the order admin, you would need to use:

    add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );

    You can read more about that here:

    https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-7

    Cheers!

    Thread Starter dimaregabriele

    (@dimaregabriele)

    My code add is:

    add_filter( 'woocommerce_checkout_fields', 'bbloomer_shipping_phone_checkout' );
     
    function bbloomer_shipping_phone_checkout( $fields ) {
       $fields['shipping']['shipping_phone'] = array(
          'label' => 'Numero di telefono per consegna',
          'required' => true,
          'class' => array( 'form-row-wide' ),
          'priority' => 25,
       );
       return $fields;
    }
      
    add_action( 'woocommerce_admin_order_data_after_shipping_address', 'bbloomer_shipping_phone_checkout_display' );
     
    function bbloomer_shipping_phone_checkout_display( $order ){
        echo '<p><b>Telefono per consegna:</b> ' . get_post_meta( $order->get_id(), '_shipping_phone', true ) . '</p>';
    }
    
    

    but dont work..

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘edit or insert shipping phone’ is closed to new replies.