Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
i use <div>{{customer.phone}}</div> but is shows null
i am sure that the customer phone number is saved in customer account
Solved! Go to the solution
This is an accepted solution.
Hi
To access the customer’s phone number in Shopify's Liquid code, ensure a few key things:
Verify Access Context: Check that you're in a context that has access to the customer object, such as in the customer account page, email templates, or within orders (if linked to a customer). The customer.phone attribute won’t work on pages or templates where customer data isn’t accessible, such as general product or homepage templates.
Check the Theme Settings: Some themes or pages might not automatically load customer details, especially if the customer is not logged in. Make sure the page where you're using this code is accessible only after login, or that the customer is indeed logged in when viewing this code.
Alternative Code Verification: Try using the following code on a page where you’re sure the customer data should be accessible (e.g., the customer account page):
Permissions and Privacy Settings: Check if there are any privacy settings on your Shopify store or restrictions in your Liquid template that prevent displaying personal customer data.
If you're still getting null, the problem might be with the specific template you're using, as not all templates allow access to customer data. Try placing this code on the account page or a similar customer-specific page to verify.
This is an accepted solution.
Hi
To access the customer’s phone number in Shopify's Liquid code, ensure a few key things:
Verify Access Context: Check that you're in a context that has access to the customer object, such as in the customer account page, email templates, or within orders (if linked to a customer). The customer.phone attribute won’t work on pages or templates where customer data isn’t accessible, such as general product or homepage templates.
Check the Theme Settings: Some themes or pages might not automatically load customer details, especially if the customer is not logged in. Make sure the page where you're using this code is accessible only after login, or that the customer is indeed logged in when viewing this code.
Alternative Code Verification: Try using the following code on a page where you’re sure the customer data should be accessible (e.g., the customer account page):
Permissions and Privacy Settings: Check if there are any privacy settings on your Shopify store or restrictions in your Liquid template that prevent displaying personal customer data.
If you're still getting null, the problem might be with the specific template you're using, as not all templates allow access to customer data. Try placing this code on the account page or a similar customer-specific page to verify.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024