Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi !
I have a B2B website and I try, with custom Liquid, to show to loggued in customers the name of their contact in my company.
I have created a custom company text metafield (custom.commercial_b2b) in which i can, for each company, enter the name of the person they need to contact.
There is the code I tried to show this custom metafield content on the front of my store :
{% if customer %} {% assign company_metaobject = customer.metafields.custom.commercial_b2b.value %} <div> <p style="font-size:20px; text-align:center;font-weight:bold" >{{ company_metaobject}}</p> </div> {% endif %}
Could you please help me ? I have searched in many topics but i don't get where I'm wrong.
Thanks !
Hi @WebSO ,
Would you please confirm if you have created a metafield or a metaobject because each has a different ways to access the values?
Hi !
I'ts a metafield.
okay great,
on which page you are trying to show this value?
can you give me the collaborator access so that I can analyze the problem in more detail?
It's on my HP.
I don't have the authorization to give you this access unfortunately
okay no worries.
Just let me know on which page you are trying to show this metafield and which theme you are using?
I have tested your code on my own store and it is displaying the value correctly.
So there might be a problem with the definition of your metafield.
Have you defined it as a Single Line Text?
Also have you selected One Value option while creating metafield or List of Values option?
Yes and one value! I'm using Dawn theme, and i want to display it on my homepage
Hmmm, that's weird as it should work.
Have you checked the value by creating and logging in to customer account?
What is displaying in that field?
Nothing is displayed
Hi, it seems that without getting access to your store I am unable to do anything.
if you want you can schedule a call with me where I can troubleshoot your issue
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025