AbiirSkincare/Hydrogen/web/app/graphql/customer-account/CustomerWishlistReadQuery.ts

17 lines
546 B
TypeScript

/**
* Logged-in wishlist: read JSON array of product handles from a customer metafield.
* Create in Admin: customer metafield, namespace `custom`, key `abiir_wishlist`, type `JSON`.
* If missing, the query still succeeds with `metafield: null`.
*/
export const CUSTOMER_WISHLIST_READ_QUERY = `#graphql
query CustomerWishlistRead($language: LanguageCode) @inContext(language: $language) {
customer {
id
metafield(namespace: "custom", key: "abiir_wishlist") {
value
compareDigest
}
}
}
` as const;