Skip to main content

cartMetafieldsSetDefault

Creates a function that accepts an array of CartMetafieldsSetInput without ownerId and set the metafields to a cart

required

CartMetafieldsSetFunction

export type = ( metafields: [], optionalParams?: , ) => Promise<>;
Examples

JavaScript

import {cartMetafieldsSetDefault} from '@shopify/hydrogen';

const cartSetMetafields = cartMetafieldsSetDefault({
storefront,
getCartId,
});

const result = await cartSetMetafields([
{
key: 'custom.gift',
type: 'boolean',
value: 'true',
},
]);
Was this page helpful?