get
Gets a resource object by ID or handle, or gets a value from an object by key.
This filter supports two usage patterns:
- When used with all_products, all_collections, all_articles, all_blogs, or all_pages, it gets a single resource object by the specified ID or handle.
- When used with an object other than the resource collection objects mentioned above, it gets the value of the specified key from that object.
CAUTION
To ensure store performance and responsiveness, this filter can be called up to 50 times during a single page rendering process. When multiple calls use identical input parameters, they are deduplicated and counted as one call. Once the call limit is reached, subsequent calls will return nil.
obj | get(key) returns data of any type.
Required params
-
objany: The resource collection or object to read from. -
keystring: The ID or handle of the desired resource, or the key of the desired value.
Examples
Getting a product by handle and rendering the product title
{{#var myProduct = all_products | get("winter-wonderland-gift-box") /}}
{{ myProduct.title }}
Getting a value from an object by key
{{ product | get("title") }}
Was this article helpful to you?