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áku
czech-names-app.gendercustomer.metafields["czech-names-app"]["gender"]male, female, unknown

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.

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 %}

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 %}
Dobrý den, {{ czech_first }},
{% else %}
Dobrý den,
{% 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"] %}
{% if czech_first != blank %}
<h2>Vítejte, {{ czech_first }}!</h2>
{% else %}
<h2>Vítejte!</h2>
{% endif %}
{% 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"] %}
{% if czech_first != blank %}<p>Děkujeme, {{ czech_first }}!</p>{% else %}<p>Děkujeme!</p>{% endif %}

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"] }}