Advertisement
palsushobhan

wcfm-orderlist-customer-shipping-phone

Jun 10th, 2025
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. add_action('wcfm_orderlist_shipping_address', function($address, $order_id) {
  2.     $order = wc_get_order($order_id);
  3.     if(!$order || !apply_filters( 'wcfm_allow_view_customer_email', true ) || !apply_filters( 'wcfm_allow_view_customer_billing_email', true ) ) return $address;
  4.     if($order->get_shipping_phone()) {
  5.         $address .= '<p><strong>Phone:</strong> ' . make_clickable( esc_html( $order->get_shipping_phone() ) ) . '</p>';
  6.     } else {
  7.         if ( is_callable( array( $order, 'get_billing_phone' ) ) ) {
  8.             $field_value = $order->get_billing_phone( );
  9.         } else {
  10.             $field_value = $order->get_meta( '_' . 'billing_phone' );
  11.         }
  12.         $address .= '<br /><strong>Phone:</strong> ' . make_clickable( esc_html( $field_value ) );
  13.     }
  14.     return $address;
  15. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement