WooCommerce: Add Shipping Phone @ Checkout

I’m surprised WooCommerce doesn’t offer this field out of the box. Most ecommerce websites actually require a shipping phone to organize delivery and communicate with the end customer in case there are problems.

Thankfully, there is a hook (filter) for that. It’s called “woocommerce_checkout_fields” and can be used to remove, move or add checkout fields quickly. And here’s how to add, for example, a new shipping field called “shipping_phone”. Enjoy!

How to create a new checkout field: shipping phone

PHP Snippet: Display Shipping Phone @ Checkout Fields

/**
 * @snippet       Shipping Phone & Email - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_checkout_fields', 'bbloomer_shipping_phone_checkout' );

function bbloomer_shipping_phone_checkout( $fields ) {
	$fields['shipping']['shipping_phone'] = array(
		'label' => 'Phone',
      'type' => 'tel',
		'required' => false,
		'class' => array( 'form-row-wide' ),
      'validate' => array( 'phone' ),
		'autocomplete' => 'tel',
		'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>Shipping Phone:</b> ' . get_post_meta( $order->get_id(), '_shipping_phone', true ) . '</p>';
}

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

24 thoughts on “WooCommerce: Add Shipping Phone @ Checkout

  1. Just added this and works great. Thank you

  2. This is great. Can you tweak it a bit to behave more like the billing phone field where only numbers, brackets and dashes are allowed? I tried setting the type as ‘tel’ with no luck. I also tried ‘number’ but I’m not getting it to quite matchup to the billing phone field.

    1. Thanks for your feedback, Anan. Changed the snippet a little, check it out

  3. Hi,
    Thanks a lot for the snippet! It works great.

  4. Hi there,

    Thanks a lot for the snippet! It works like a charm.

    Is there a way to get the phone number in emails as well? is there a short code for it? Am trying to add it to my email customizer builder.

    1. Hi Najm, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      1. adding phone in the email should be part of this. Come on Rodolfo, you’ll be charging 100 USD just to show us how to do this?

        1. I have this already in other snippets on this same site: https://www.businessbloomer.com/woocommerce-add-custom-checkout-field-php/ (part 3).

          As you can see, I share all my knowledge for free, so I charge only when the customer has no time or knowledge. You simply had to do a search on Business Bloomer, but it seems you didn’t have the time lol

  5. I just added this and it still works 🙂

    1. Great!

  6. Thanks! I love your website – I learned a lot from your code snippets and started always looking for code-snippet solutions instead of adding plugins for everything!

    I added this code and it shows up correctly in the checkout page. How to add a second field (shipping email for example) in addition to the first field?

    1. Hello Judith, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  7. congratulations for the code and thanks. Is it possible to make the field editable from backend? because when I have to add orders manually I can’t enter the number

    1. Hi Gabriele, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  8. Hi,

    I’m Nani.
    I’ve added this kind of thing, but somehow now showing the phone number in email.
    How to solve that?
    Thanks.

    1. Hi Nani, I don’t fully understand. Can you provide a screenshot please?

      1. I guess the question was how to have the recipient’s phone visible in the new order email (shipping address details) – there should be a line of code that adds shipping phone number in the new order email template.

        1. Ah, gotcha. Yes, that’s a complex yet doable customization

  9. Thank you! This still works, however the shipping fields end up misaligned with the billing fields since the Shipping Phone is inserted after the Name instead of after the Zip. The example given at https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ has a cleaner implementation.

    1. Thank you!

  10. Thank you Rodolfo,
    code is working, text field is added in checkout page, is present in the order in the back office, but is not returned in the “Thank you for your order” email
    Grazie
    Mauro

    1. Correct, Mauro. Try studying this: https://businessbloomer.com/woocommerce-add-custom-checkout-field-php/ (part #5 snippet #2)

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published.