--- title: useMetafield description: Returns a single filtered `Metafield` or `undefined`. api_version: 2023-04 api_name: checkout-ui-extensions source_url: html: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-04/react-hooks/metafields/usemetafield md: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-04/react-hooks/metafields/usemetafield.md --- # use​Metafield Returns a single filtered `Metafield` or `undefined`. ## use​Metafield([filters](#-propertydetail-filters)​) ### Parameters * filters MetafieldFilter required ### Returns * Metafield | undefined ### MetafieldFilter * namespace ```ts string ``` * key ```ts string ``` ```ts interface MetafieldFilter { namespace: string; key: string; } ``` ### Metafield Metadata associated with the checkout. * key The name of the metafield. It must be between 3 and 30 characters in length (inclusive). ```ts string ``` * namespace A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive). ```ts string ``` * value The information to be stored as metadata. ```ts string | number ``` * valueType The metafield’s information type. ```ts "string" | "integer" | "json_string" ``` ```ts export interface Metafield { /** * The name of the metafield. It must be between 3 and 30 characters in * length (inclusive). */ key: string; /** * A container for a set of metafields. You need to define a custom * namespace for your metafields to distinguish them from the metafields * used by other apps. This must be between 2 and 20 characters in length (inclusive). */ namespace: string; /** * The information to be stored as metadata. */ value: string | number; /** The metafield’s information type. */ valueType: 'integer' | 'string' | 'json_string'; } ``` ## Related [APIs - StandardApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi) [APIs - CheckoutApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/checkoutapi) [APIs - OrderStatusApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/orderstatusapi) [APIs - CartLineDetailsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cartlinedetailsapi) [APIs - PickupPointsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuppointsapi) [APIs - PickupLocationsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuplocationsapi) [APIs - ShippingMethodDetailsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/shippingmethoddetailsapi) [APIs - ExtensionPoints](https://shopify.dev/docs/api/checkout-ui-extensions/apis/extensionpoints)