Woocommerce - Add Shipping Phone Number (3 posts)

  1. geofflaskey87
    Posted 2 years ago #

    I'm trying to add a shipping phone number to my woocommerce checkout page. I've got the field added with the code supplied. I need to get it to pull through to woocommerce in the admin area, so when orders are sent I can give fed-ex the shipping phone number (it's overnight crab shipping, so they need to be able to contact the recipient.)

    here's the code I got from woocommerce

    // Hook in
    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;
  2. kims126
    Posted 1 year ago #

  3. bcworkz
    Posted 1 year ago #

    I don't know anything about woocommerce really, but I was curious. I looked over this document. It does appear the value is getting saved, which was my first concern. But it appears the saved value doesn't show up in admin without doing more coding. I'm guessing the second to last example is a clue if not an answer, even though it's for data from a field added through a different process.

    I hope that helps some, good luck.

Topic Closed

This topic has been closed to new replies.

About this Topic