---
title: "get_metafield"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/sline/filter/get-metafield'
  md: 'https://developer.shopline.com/docs/sline/filter/get-metafield.md'
---

# get_metafield


    Gets a [metafield](https://developer.shopline.com/docs/sline/object/metafield.md) object associated with a specific resource by using the namespace and key parameters.

    Unlike the [get_metafields](https://developer.shopline.com/docs/sline/filter/get-metafields.md) filter, the `get_metafield` filter retrieves a `metafield` object by specifying the `namespace` and `key` parameters.

> **CAUTION**
>
> To ensure store performance and responsiveness, the maximum number of times this filter can be called during a single page rendering proccess is 50. When multiple calls include identical input parameters, these calls will be deduplicated and counted as one call. Once the call limit is reached, subsequent calls will return `nil`.



    
`object | get_metafield(namespace, key)` returns a [`metafield`](https://developer.shopline.com/docs/sline/object/metafield.md) object.
    



    
        ## Required Params

        
            - `object` `any`: The specified resource object. Valid values: [product](https://developer.shopline.com/docs/sline/object/product.md), [collection](https://developer.shopline.com/docs/sline/object/collection.md), [blog](https://developer.shopline.com/docs/sline/object/blog.md), [article](https://developer.shopline.com/docs/sline/object/article.md), [page](https://developer.shopline.com/docs/sline/object/page.md), [order](https://developer.shopline.com/docs/sline/object/order.md)
, [customer](https://developer.shopline.com/docs/sline/object/customer.md), [variant](https://developer.shopline.com/docs/sline/object/variant.md), [shop](https://developer.shopline.com/docs/sline/object/shop.md), and [company](https://developer.shopline.com/docs/sline/object/company.md).

        
            - `namespace` `string`: The namespace of the metafield.
        
            - `key` `string`: The unique identifier for the metafield within its namespace.
        
    





    
        ## Example

        
            

            

            

            
<SlineExample path={'/products/vip3'} objects={ 
    [""] 
}>
```sline
{{#var mf = product | get_metafield("demo_ns", "demo_key") /}}
{{ mf.value }}
```
</SlineExample>
            
        
    
