Change True/Fales to Yes/No

21 0 22



Does anyone know how to change "True/False" in the Metafield settings to "Yes/No"? Or at least capitalize the "true" and "false" outputs?

Reply 1 (1)

Shopify Staff
2731 298 769

Hi Uni-Trend,


Just to confirm, you'd like this change to appear on the front-end of your store. IE: so customers would see Yes or No being displayed on a page where a metafield is true or false (or have the output capitalized). 


If so, you should be able to do this via Liquid by setting up some conditional tags based on the true/false value of the metafield. For example if this is a product based metafield you could set up logic in your theme where the metafield is being included that would look something like this:

{% if product.metafields.custom.test_yes_no == true %}
{% else %}
{% endif %}

Now on products where the True or False metafield is set to True, you'll see "Yes" being displayed and on products where the True or False metafield is set to False, you'll see "No" being displayed. You should be able to use this approach for metafields based on other resources like variants or collections. (The product.metafields.custom.test_yes_no is just a demo namespace and key I've set up, you'd replace this with your own)


If you just want to capitalize the output of the metafield you can use the capitalize Liquid string filter like this:

{{ product.metafields.custom.test_yes_no | capitalize }}

This will ensure that the first letter of the output will be capitalized, eg: "True" or "False". 


Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog