• Resolved thehoundproject

    (@thehoundproject)


    Hi There,

    I have a problem with the woocommerce order details page and that is it doesn’t list the customer phone number. It is a mandatory field on my billing info page, but it doesn’t appear anywhere on the notification page or email.

    Can I do something to correct this? I need to collect customer phone numbers for shipping purposes.

    Many thanks.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • hello @thehoundproject Below code will add phone no

    /**
    * This function will add phone number into the Order details page.
    *
    * @name mwb_add_phone_no
    * @param array $order Array of the order.
    * @author Mohit Mishra
    * @link https://makewebbetter.com
    */
    function mwb_add_phone_no( $order ) {
    	?>
    	<tr>
    		<th><?php esc_html_e( 'Phone No.','textdomain'); ?></th>
    		<td><?php echo esc_html( get_post_meta( $order->get_id(), '_billing_phone', true ) )?></td>
    	</tr>
    	<?php
    }
    add_action( 'woocommerce_order_details_after_order_table_items', 'mwb_add_phone_no' );
    
    Thread Starter thehoundproject

    (@thehoundproject)

    Hello Mohit

    Thank you for this. Will it go to functions.php?

    THX

    @thehoundproject Yes you have to put his code into the functions.php of the current activated theme.

    D Smith a11n

    (@dsmithweb)

    Automattic Happiness Engineer

    Hi there!

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread resolved. If you have any other questions, please feel free to start a new thread!

    Thread Starter thehoundproject

    (@thehoundproject)

    Hey guys,

    I tried to add the above code to my functions.php and the system said it was rolled back, as in couldn’t save changes as there was a mistake in the code.

    Could you help out?
    Many thanks.

    Reka

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Order details page not listing customer phone number’ is closed to new replies.