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.