How can I showing a shipping phone number in customer order page?

Solved

How can I showing a shipping phone number in customer order page?

Woody_JEKCA
New Member
11 0 0

Hi All,

 

I would like to see how can I displaying the shipping phone number in the customer order page?

ca2.jpg

 

I tried to add a code 

{{ address.phone | format_address }}

or 

{{ order.phone | format_address }}

 

 

right under the code 

{{ order.shipping_address | format_address }}

in main-order.liquid. But it seems I have no luck. How can I display it correctly? I am using the theme Dawn. Thank you.

 

 

Capture1.JPG

 

Accepted Solution (1)

Junaid-Ahmed
Shopify Partner
80 17 17

This is an accepted solution.

Hi  Woody, welcome to the Shopify Community.

 

The correct code you're looking for is 

{{ order.shipping_address.phone }}

 

but its not always the case that a customer will add a different shipping address. The following code will print shipping address' phone number, if that's not available then print the billing address' phone number and if that's not available, use the customer's main phone number.

{% liquid
  if order.shipping_address.phone
    echo order.shipping_address.phone
  elsif order.billing_address.phone
    echo order.billing_address.phone
  else
    echo customer.phone
  endif
%}
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.

View solution in original post

Replies 2 (2)

Junaid-Ahmed
Shopify Partner
80 17 17

This is an accepted solution.

Hi  Woody, welcome to the Shopify Community.

 

The correct code you're looking for is 

{{ order.shipping_address.phone }}

 

but its not always the case that a customer will add a different shipping address. The following code will print shipping address' phone number, if that's not available then print the billing address' phone number and if that's not available, use the customer's main phone number.

{% liquid
  if order.shipping_address.phone
    echo order.shipping_address.phone
  elsif order.billing_address.phone
    echo order.billing_address.phone
  else
    echo customer.phone
  endif
%}
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.
JazziCrystals
Visitor
3 0 0

How do I change my shipping details? My information the customer sees when they checkout.