Hi there, I am trying to make use of the customer phone number in a checkout ui extension. When an email is not provided, I’d like to use the phone number.
I am updated my customer protected data to reflect this and it has been approved.
What I have found is that when I use usePhone on the thank you page, I am returned a string, but in my case it is a UK mobile number starting with 0, e.g. 07000111222. I’d like to use this phone number as part of a graphql customer query in my app, but that only works with the full country code, e.g. +447000111222. I can’t see a way for me to find out in the checkout ui extension what the country code should be. Interestingly, when I use prevent_redirect=true and refresh the thank you page, on the second load I am given the phone number with the full country code.
Secondly, when I move to the order status page, usePhone just returns an empty string. Yet with useEmail, this works on both the thank you page and the order status page.
So my questions are:
- How do I get a country code formatted phone number on the thank you page?
- How do I get the phone number for the customer on the order status page?
Many thank in advance for any help here.