• Resolved blue

    (@life2)


    Hi,

    I’m using an order fulfillment company for fulfilling our online orders. The shop is integrated with their system so they receive the orders automatically. But the phone number field does not translate with other order details.

    The developer responsible for the integration said I would need to add this value (order.shipping.phone) to the order object, so that it can be picked up by the integration. They also mentioned that I need to add coding to the cart that modifies the shipping section So that it contains the phone number.

    Can you help me with this?

    By the way, I was able to add a new field for phone number in the shipping section. But it still does not get picked up by the integration. Following is the code I’m using:

    /* Add additional shipping fields (phone) in FRONT END (i.e. My Account and Order Checkout) */
    /* Note:  $fields keys (i.e. field names) must be in format: "shipping_" */
    add_filter( 'woocommerce_shipping_fields' , 'my_additional_shipping_fields' );
    function my_additional_shipping_fields( $fields ) {
        $fields['shipping_phone'] = array(
            'label'         => __( 'Shipping Phone', 'woocommerce' ),
            'required'      => true,
            'class'         => array( 'form-row-last' ),
            'clear'         => true,
            'validate'      => array( 'phone' ),
        );
        return $fields;
    }
    /* Display additional shipping fields (phone) in ADMIN area (i.e. Order display ) */
    /* Note:  $fields keys (i.e. field names) must be in format:  WITHOUT the "shipping_" prefix (it's added by the code) */
    add_filter( 'woocommerce_admin_shipping_fields' , 'my_additional_admin_shipping_fields' );
    function my_additional_admin_shipping_fields( $fields ) {
            $fields['phone'] = array(
                'label' => __( 'Shipping Phone', 'woocommerce' ),
            );
            return $fields;
    }
    /* Display additional shipping fields (phone) in USER area (i.e. Admin User/Customer display ) */
    /* Note:  $fields keys (i.e. field names) must be in format: shipping_ */
    add_filter( 'woocommerce_customer_meta_fields' , 'my_additional_customer_meta_fields' );
    function my_additional_customer_meta_fields( $fields ) {
            $fields['shipping']['fields']['shipping_phone'] = array(
                'label' => __( 'Telephone', 'woocommerce' ),
                'description' => '',
            );
            return $fields;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shipping phone number is missing’ is closed to new replies.