Returns the metafields configured with `shopify.extension.toml`.
Returns the metafields configured with `shopify.extension.toml`.
filters: AppMetafieldFilters
export function useAppMetafields< Target extends RenderExtensionTarget = RenderExtensionTarget, >(filters: AppMetafieldFilters = {}): AppMetafieldEntry[] { const appMetafields = useSubscription(useApi<Target>().appMetafields); return useMemo(() => { if (filters.key && !filters.namespace) { throw new CheckoutUIExtensionError( 'You must pass in a namespace with a key', ); } const filterKeys = Object.keys(filters) as AppMetafieldFilterKeys[]; if (filterKeys.length) { return appMetafields.filter((app) => { return filterKeys.every((key) => { if (key === 'id' || key === 'type') { return app.target[key] === filters[key]; } return app.metafield[key] === filters[key]; }); }); } return appMetafields; }, [filters, appMetafields]); }
A metafield associated with the shop or a resource on the checkout.
The target that is associated to the metadata. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data) when the type is `customer`, `company` or `companyLocation`.
The metadata information.
The metafield owner.
The type of the metafield owner. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data) when the type is `customer`, `company` or `companyLocation`.
The numeric owner ID that is associated with the metafield.
Represents a custom metadata attached to a resource.
The key name of a metafield.
The namespace for a metafield.
The value of a metafield.
The metafield’s information type.
The metafield's type name.