Dears ,
I have Custom Field its name “title” for example
its value 1,2,3… for example
I can call the value using this code in my theme : {{ custom_fields[“title”] }}
how to get the name of the Custom Field as a lable and the value at the same time
to shown like this title: 1
also how to print the custom field if it is exist using if statement Mr. @lubos
Try this
{{ custom_fields["label"] }}
not working , this code calling the field value not label
I want to print the field name
The field values are called by either:
{{ custom_fields["text"] }}
Or
{{ custom_fields["number"] }}
But I guess you wanted the field’s UUID. Is that right?
sorry I don’t understand what is the UUID, in simple i want to print the custom field name/label as a label
if there is a code can do that , also how to use if statement to print something if the custom filed has a value not null/empty
Now I don’t understand you as well.
First just to clear the confusion, a typical custom field’s database name goes something like this:
CustomFields.5e709c6627f8482b910229eab43f862f
And the string 5e709c66-27f8-482b-9102-29eab43f862f
is the UUID of that custom field.
I don’t think you want to print that anywhere, right?
There name you use is called a ‘label’ for the custom field but I kind of get the impression that you didn’t even bother to test this {{ custom_fields["label"] }}
. Did you?
yes right, i don’t want that.
yes I test it , should I define the custom field name first to get its label or the name as a label ?
When you setup your custom fields, the form asks for a name that you type in. This name will then be used as a label.
Good, how to print this label?
when I tried this {{ custom_fields[“label”] }} I got the value of the field 1,2,3 drop down list as the image not the “title” , I need a code to get field label only not the value if this available .
and if statement to do something if the field label/value == ….
print out : title : 1,2…etc
Provide screenshots of the following:
- Edit screen of your custom theme
- View screen of the transaction where the error occurs