Skip to content

Liquid Usage

The declined name values are stored as customer metafields and are available anywhere Shopify exposes the customer object in Liquid — including email notification templates, order confirmations, theme pages, and customer account templates.

MetafieldLiquid keyExample value
czech-names-app.addressingcustomer.metafields["czech-names-app"]["addressing"]Jane
czech-names-app.last-name-addressingcustomer.metafields["czech-names-app"]["last-name-addressing"]Novákové
czech-names-app.gendercustomer.metafields["czech-names-app"]["gender"]male, female, unknown

Always provide a fallback in case the metafield has not been populated yet (for example, for customers who existed before the app was installed):

{% if customer.metafields["czech-names-app"]["addressing"] != blank %}
{{ customer.metafields["czech-names-app"]["addressing"] }}
{% else %}
{{ customer.first_name }}
{% endif %}

Or using the compact form with the | default filter:

{{ customer.metafields["czech-names-app"]["addressing"] | default: customer.first_name }}
{% assign czech_first = customer.metafields["czech-names-app"]["addressing"] %}
{% assign czech_last = customer.metafields["czech-names-app"]["last-name-addressing"] %}
{% if czech_first != blank %}
{{ czech_first }} {{ czech_last }}
{% else %}
{{ customer.first_name }} {{ customer.last_name }}
{% endif %}

Use the gender metafield to render different text for male and female customers:

{% assign gender = customer.metafields["czech-names-app"]["gender"] %}
{% assign czech_first = customer.metafields["czech-names-app"]["addressing"] | default: customer.first_name %}
{% assign czech_last = customer.metafields["czech-names-app"]["last-name-addressing"] | default: customer.last_name %}
{% if gender == "male" %}
Vážený pane {{ czech_first }} {{ czech_last }},
{% elsif gender == "female" %}
Vážená paní {{ czech_first }} {{ czech_last }},
{% else %}
Vážený zákazníku {{ czech_first }} {{ czech_last }},
{% endif %}

Shopify email notification templates (order confirmation, shipping confirmation, etc.) support Liquid. To add a personalized Czech greeting:

  1. Go to Settings → Notifications in your Shopify admin
  2. Select the notification you want to customize (for example, Order confirmation)
  3. Click Edit code
  4. Add the greeting block near the top of the email body:
{% assign czech_first = customer.metafields["czech-names-app"]["addressing"] %}
{% assign gender = customer.metafields["czech-names-app"]["gender"] %}
<p>
{% if czech_first != blank %}
{% if gender == "male" %}Vážený pane{% elsif gender == "female" %}Vážená paní{% else %}Dobrý den{% endif %} {{ czech_first }},
{% else %}
Dobrý den {{ customer.first_name }},
{% endif %}
</p>

In theme .liquid files (account pages, custom pages), you can access customer metafields when a customer is logged in:

{% if customer %}
{% assign czech_first = customer.metafields["czech-names-app"]["addressing"] | default: customer.first_name %}
<h2>Vítejte, {{ czech_first }}!</h2>
{% endif %}

The order confirmation (checkout.liquid or order-status.liquid) exposes checkout.customer or order.customer:

{% assign czech_first = order.customer.metafields["czech-names-app"]["addressing"] | default: order.customer.first_name %}
<p>Děkujeme, {{ czech_first }}!</p>

If you need to inspect the raw values for debugging, you can output all three at once:

{% comment %}Debug block — remove before publishing{% endcomment %}
addressing: {{ customer.metafields["czech-names-app"]["addressing"] }}<br>
last-name-addressing: {{ customer.metafields["czech-names-app"]["last-name-addressing"] }}<br>
gender: {{ customer.metafields["czech-names-app"]["gender"] }}