hook
Returns a function to mutate the metafields
property of the checkout.
Returns a function to mutate the `metafields` property of the checkout.
Returns a function to mutate the `metafields` property of the checkout.
export function useApplyMetafieldsChange< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): (change: MetafieldChange) => Promise<MetafieldChangeResult> { const api = useApi<Target>(); if ('applyMetafieldChange' in api) { return api.applyMetafieldChange; } throw new ExtensionHasNoMethodError( 'applyMetafieldChange', api.extension.target, ); }
MetafieldRemoveChange | MetafieldUpdateChange | MetafieldRemoveCartChange | MetafieldUpdateCartChange
Removes a metafield.
The type of the `MetafieldRemoveChange` API.
The name of the metafield to remove.
The namespace of the metafield to remove.
Metadata associated with the checkout.
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
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).
The information to be stored as metadata.
The metafield’s information type.
Updates a metafield. If a metafield with the provided key and namespace does not already exist, it gets created.
The type of the `MetafieldUpdateChange` API.
The name of the metafield to update.
The namespace of the metafield to add.
The new information to store in the metafield.
The metafield’s information type.
Removes a cart metafield.
The type of the `MetafieldRemoveChange` API.
The name of the metafield to remove.
The namespace of the metafield to remove.
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 type name.
Updates a cart metafield. If a metafield with the provided key and namespace does not already exist, it gets created.
The type of the `MetafieldUpdateChange` API.
MetafieldChangeResultSuccess | MetafieldChangeResultError
The type of the `MetafieldChangeResultSuccess` API.
The type of the `MetafieldChangeResultError` API.
A message that explains the error. This message is useful for debugging. It is **not** localized, and therefore should not be presented directly to the buyer.
Returns a function to mutate the metafields
property of the checkout.
Shopify uses cookies to provide necessary site functionality and improve your experience. By using our website, you agree to our privacy policy