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áku |
czech-names-app.gender | customer.metafields["czech-names-app"]["gender"] | male, female, unknown |
Basic access with fallback
Section titled “Basic access with fallback”The metafields are missing for customers who existed before the app was installed, and for customers whose first name the app cannot decline. Both cases need a fallback.
{% if customer.metafields["czech-names-app"]["addressing"] != blank %} Dobrý den, {{ customer.metafields["czech-names-app"]["addressing"] }},{% else %} Dobrý den,{% endif %}The | default: filter is not a shortcut here — | default: customer.first_name inserts precisely the undeclined form. Use a condition that drops the name instead.
Gender-conditional greeting
Section titled “Gender-conditional greeting”In Czech, “Vážený pane” and “Vážená paní” are followed by the last name, so read last-name-addressing there. The first name belongs in the informal greeting.
{% assign gender = customer.metafields["czech-names-app"]["gender"] %}{% assign czech_first = customer.metafields["czech-names-app"]["addressing"] %}{% assign czech_last = customer.metafields["czech-names-app"]["last-name-addressing"] %}
{% if czech_last != blank and gender == "male" %} Vážený pane {{ czech_last }},{% elsif czech_last != blank and gender == "female" %} Vážená paní {{ czech_last }},{% elsif czech_first != blank %} Dobrý den, {{ czech_first }},{% else %} Dobrý den,{% 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 %} Dobrý den, {{ czech_first }}, {% else %} Dobrý den, {% 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"] %} {% if czech_first != blank %} <h2>Vítejte, {{ czech_first }}!</h2> {% else %} <h2>Vítejte!</h2> {% endif %}{% 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"] %}{% if czech_first != blank %}<p>Děkujeme, {{ czech_first }}!</p>{% else %}<p>Děkujeme!</p>{% endif %}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"] }}