-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Couldn't simply find something in the dev docs. Is this an intentional and supported feature?
It is currently possible to use the assign tag with a default filter to define key-value pairs for an object, as shown below:
{% comment %} Example from the documentation {% endcomment %}
{% assign client_address = client_address | default: street: "Innovation Drive 22", city: "Capital City" %}
{% assign client = client | default: name: "Future Solutions Ltd.", address: client_address %}This effectively creates a nested hash, which can then be accessed using standard dot notation:
{{ client.name }} // Outputs: Future Solutions Ltd.
{{ client.address.street }} // Outputs: Innovation Drive 22This appears to be a very powerful and clean way to create hashes or objects directly within a Liquid template, which is a significant improvement over more complex workarounds like using capture with dynamic variable names or delimited strings, that we currently use a lot in Silverfin templates.
My Questions
- Is this
defaultfilter syntax for creating hashes an intentional and officially supported feature of Shopify's core Liquid library? - If this is a standard feature, could you please point me to the official documentation for it? I was unable to find any mention of this specific usage in the Shopify Liquid documentation.
- Is this behavior dependent on a specific version of Liquid?
- If this is not a core feature, is it possible that this is a custom filter or extension implemented by the Silverfin platform?
Thank you for your time and for providing clarity on this matter.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for Feature.