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.
Metafield reference
Section titled “Metafield reference”| Metafield | Liquid key | Example value |
|---|---|---|
czech-names-app.addressing | customer.metafields["czech-names-app"]["addressing"] | Jane |
czech-names-app.last-name-addressing | customer.metafields["czech-names-app"]["last-name-addressing"] | Novákové |
czech-names-app.gender | customer.metafields["czech-names-app"]["gender"] | male, female, unknown |
Basic access with fallback
Section titled “Basic access with fallback”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 }}Full name addressing with fallback
Section titled “Full name addressing with fallback”{% 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 %}Gender-conditional greeting
Section titled “Gender-conditional greeting”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 %}Use in email notification templates
Section titled “Use in email notification templates”Shopify email notification templates (order confirmation, shipping confirmation, etc.) support Liquid. To add a personalized Czech greeting:
- Go to Settings → Notifications in your Shopify admin
- Select the notification you want to customize (for example, Order confirmation)
- Click Edit code
- 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>Use in theme templates
Section titled “Use in theme templates”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 %}Use in order confirmation page
Section titled “Use in order confirmation page”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>Checking all three metafield values
Section titled “Checking all three metafield values”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"] }}