Optional number field given in the ship to different location in checkout is not coming in packing

This topic has 2 replies, 2 voices, and was last updated 1 years, 6 months ago ago by Rose Tyler

  • Avatar: Saira
    Saira
    Participant
    October 13, 2022 at 12:42

    In the checkout page when we checkout the product there is an option to enable ship to different address, Inside this session there was no option to enter additional phone number (ie, shipping person’s phone number) when billing and shipping person are different. So we give the following code :

    add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );

    // Our hooked in function – $fields is passed via the filter!
    function custom_override_checkout_fields( $fields ) {
    $fields[‘shipping’][‘shipping_phone’] = array(
    ‘label’ => __(‘Phone’, ‘woocommerce’),
    ‘placeholder’ => _x(‘Phone’, ‘placeholder’, ‘woocommerce’),
    ‘required’ => false,
    ‘class’ => array(‘form-row-wide’),
    ‘clear’ => true
    );

    return $fields;
    }

    add_action( ‘woocommerce_admin_order_data_after_shipping_address’, ‘my_custom_checkout_field_display_admin_order_meta’, 10, 1 );

    function my_custom_checkout_field_display_admin_order_meta($order){
    echo ‘

    ‘.__(‘Phone From Checkout Form’).’: ‘ . get_post_meta( $order->get_id(), ‘_shipping_phone’, true ) . ‘

    ‘;
    }

    This field is coming. But now the problem is that in the packing slip if the customer is entering different phone number for billing and packing, and if given different phone number in shipping address this number will not come in the packing slip. Is there is any method to solve this.

    1 Answer
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 17, 2022 at 10:33

    Hello,

    Check how it works with the default WC theme – Storefront activated.
    Let us know the result in detail, please.

    Regards

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.