diff --git a/framework/shopify/api/endpoints/checkout/checkout.ts b/framework/shopify/api/endpoints/checkout/checkout.ts index 0c340a129..0a9e83b68 100644 --- a/framework/shopify/api/endpoints/checkout/checkout.ts +++ b/framework/shopify/api/endpoints/checkout/checkout.ts @@ -19,7 +19,7 @@ const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({ try { await config.fetch(associateCustomerWithCheckoutMutation, { variables: { - checkoutId: cookies[SHOPIFY_CHECKOUT_ID_COOKIE], + cartId: cookies[SHOPIFY_CHECKOUT_ID_COOKIE], customerAccessToken: cookies[SHOPIFY_CUSTOMER_TOKEN_COOKIE], }, }) diff --git a/framework/shopify/api/operations/login.ts b/framework/shopify/api/operations/login.ts index 41e837a3f..7402fc966 100644 --- a/framework/shopify/api/operations/login.ts +++ b/framework/shopify/api/operations/login.ts @@ -3,9 +3,9 @@ import type { OperationContext } from '@commerce/api/operations' import type { LoginOperation } from '../../types/login' import type { ShopifyConfig, Provider } from '..' import { - customerAccessTokenCreateMutation, setCustomerToken, throwUserErrors, + customerAccessTokenCreateMutation, } from '../../utils' import { CustomerAccessTokenCreateMutation } from '../../schema' diff --git a/framework/shopify/cart/use-add-item.tsx b/framework/shopify/cart/use-add-item.tsx index 5f0809d01..6efa43a95 100644 --- a/framework/shopify/cart/use-add-item.tsx +++ b/framework/shopify/cart/use-add-item.tsx @@ -4,19 +4,19 @@ import { CommerceError } from '@commerce/utils/errors' import useAddItem, { UseAddItem } from '@commerce/cart/use-add-item' import type { AddItemHook } from '../types/cart' import useCart from './use-cart' - import { - checkoutLineItemAddMutation, - getCheckoutId, - checkoutToCart, + getCartId, + normalizeCart, + throwUserErrors, + cartLineItemAddMutation, } from '../utils' -import { Mutation, MutationCheckoutLineItemsAddArgs } from '../schema' +import { CartLinesAddMutation, CartLinesAddMutationVariables } from '../schema' export default useAddItem as UseAddItem export const handler: MutationHook = { fetchOptions: { - query: checkoutLineItemAddMutation, + query: cartLineItemAddMutation, }, async fetcher({ input: item, options, fetch }) { if ( @@ -28,13 +28,13 @@ export const handler: MutationHook = { }) } - const { checkoutLineItemsAdd } = await fetch< - Mutation, - MutationCheckoutLineItemsAddArgs + const { cartLinesAdd } = await fetch< + CartLinesAddMutation, + CartLinesAddMutationVariables >({ ...options, variables: { - checkoutId: getCheckoutId(), + checkoutId: getCartId(), lineItems: [ { variantId: item.variantId, @@ -44,18 +44,26 @@ export const handler: MutationHook = { }, }) - return checkoutToCart(checkoutLineItemsAdd) - }, - useHook: ({ fetch }) => () => { - const { mutate } = useCart() + throwUserErrors(cartLinesAdd?.userErrors) - return useCallback( - async function addItem(input) { - const data = await fetch({ input }) - await mutate(data, false) - return data - }, - [fetch, mutate] - ) + if (!cartLinesAdd?.cart) { + throw new CommerceError({ message: 'Missing cart from response' }) + } + + return normalizeCart(cartLinesAdd?.cart) }, + useHook: + ({ fetch }) => + () => { + const { mutate } = useCart() + + return useCallback( + async function addItem(input) { + const data = await fetch({ input }) + await mutate(data, false) + return data + }, + [fetch, mutate] + ) + }, } diff --git a/framework/shopify/cart/use-cart.tsx b/framework/shopify/cart/use-cart.tsx index d920d058a..d2d814ea6 100644 --- a/framework/shopify/cart/use-cart.tsx +++ b/framework/shopify/cart/use-cart.tsx @@ -2,56 +2,35 @@ import { useMemo } from 'react' import useCommerceCart, { UseCart } from '@commerce/cart/use-cart' import { SWRHook } from '@commerce/utils/types' -import { checkoutCreate, checkoutToCart } from '../utils' -import getCheckoutQuery from '../utils/queries/get-checkout-query' +import getCartQuery from '../utils/queries/get-cart-query' import { GetCartHook } from '../types/cart' -import { - GetCheckoutQuery, - GetCheckoutQueryVariables, - CheckoutDetailsFragment, -} from '../schema' - export default useCommerceCart as UseCart export const handler: SWRHook = { fetchOptions: { - query: getCheckoutQuery, + query: getCartQuery, }, - async fetcher({ input: { cartId: checkoutId }, options, fetch }) { - let checkout - - if (checkoutId) { - const data = await fetch({ - ...options, - variables: { - checkoutId: checkoutId, - }, + async fetcher({ input: { cartId }, options, fetch }) { + return cartId ? await fetch(options) : null + }, + useHook: + ({ useData }) => + (input) => { + const response = useData({ + swrOptions: { revalidateOnFocus: false, ...input?.swrOptions }, }) - checkout = data.node - } - - if (checkout?.completedAt || !checkoutId) { - checkout = await checkoutCreate(fetch) - } - - return checkoutToCart({ checkout }) - }, - useHook: ({ useData }) => (input) => { - const response = useData({ - swrOptions: { revalidateOnFocus: false, ...input?.swrOptions }, - }) - return useMemo( - () => - Object.create(response, { - isEmpty: { - get() { - return (response.data?.lineItems.length ?? 0) <= 0 + return useMemo( + () => + Object.create(response, { + isEmpty: { + get() { + return (response.data?.lineItems.length ?? 0) <= 0 + }, + enumerable: true, }, - enumerable: true, - }, - }), - [response] - ) - }, + }), + [response] + ) + }, } diff --git a/framework/shopify/cart/use-remove-item.tsx b/framework/shopify/cart/use-remove-item.tsx index bf9fb2d95..8e295f873 100644 --- a/framework/shopify/cart/use-remove-item.tsx +++ b/framework/shopify/cart/use-remove-item.tsx @@ -18,50 +18,54 @@ export type RemoveItemActionInput = T extends LineItem export default useRemoveItem as UseRemoveItem -import { - checkoutLineItemRemoveMutation, - getCheckoutId, - checkoutToCart, -} from '../utils' +import { getCartId, normalizeCart, throwUserErrors } from '../utils' +import cartLineItemRemoveMutation from '../utils/mutations/cart-line-item-remove' -import { Mutation, MutationCheckoutLineItemsRemoveArgs } from '../schema' +import { + CartLinesRemoveMutation, + CartLinesRemoveMutationVariables, +} from '../schema' export const handler = { fetchOptions: { - query: checkoutLineItemRemoveMutation, + query: cartLineItemRemoveMutation, }, async fetcher({ input: { itemId }, options, fetch, }: HookFetcherContext) { - const data = await fetch({ + const data = await fetch< + CartLinesRemoveMutation, + CartLinesRemoveMutationVariables + >({ ...options, - variables: { checkoutId: getCheckoutId(), lineItemIds: [itemId] }, + variables: { cartId: getCartId(), lineItemIds: [itemId] }, }) - return checkoutToCart(data.checkoutLineItemsRemove) - }, - useHook: ({ fetch }: MutationHookContext) => < - T extends LineItem | undefined = undefined - >( - ctx: { item?: T } = {} - ) => { - const { item } = ctx - const { mutate } = useCart() - const removeItem: RemoveItemFn = async (input) => { - const itemId = input?.id ?? item?.id - if (!itemId) { - throw new ValidationError({ - message: 'Invalid input used for this operation', - }) + throwUserErrors(data.cartLinesRemove?.userErrors) + + return normalizeCart(data.cartLinesRemove?.cart) + }, + useHook: + ({ fetch }: MutationHookContext) => + (ctx: { item?: T } = {}) => { + const { item } = ctx + const { mutate } = useCart() + const removeItem: RemoveItemFn = async (input) => { + const itemId = input?.id ?? item?.id + + if (!itemId) { + throw new ValidationError({ + message: 'Invalid input used for this operation', + }) + } + + const data = await fetch({ input: { itemId } }) + await mutate(data, false) + return data } - const data = await fetch({ input: { itemId } }) - await mutate(data, false) - return data - } - - return useCallback(removeItem as RemoveItemFn, [fetch, mutate]) - }, + return useCallback(removeItem as RemoveItemFn, [fetch, mutate]) + }, } diff --git a/framework/shopify/cart/use-update-item.tsx b/framework/shopify/cart/use-update-item.tsx index 3f1cf4315..7ce2e9060 100644 --- a/framework/shopify/cart/use-update-item.tsx +++ b/framework/shopify/cart/use-update-item.tsx @@ -10,12 +10,14 @@ import useUpdateItem, { UseUpdateItem } from '@commerce/cart/use-update-item' import useCart from './use-cart' import { handler as removeItemHandler } from './use-remove-item' import type { UpdateItemHook, LineItem } from '../types/cart' +import { getCartId, normalizeCart } from '../utils' import { - getCheckoutId, - checkoutLineItemUpdateMutation, - checkoutToCart, -} from '../utils' -import { Mutation, MutationCheckoutLineItemsUpdateArgs } from '../schema' + CartLinesUpdateMutation, + CartLinesUpdateMutationVariables, + Mutation, + MutationCheckoutLineItemsUpdateArgs, +} from '../schema' +import cartLineItemUpdateMutation from '../utils/mutations/cart-line-item-update' export type UpdateItemActionInput = T extends LineItem ? Partial @@ -25,7 +27,7 @@ export default useUpdateItem as UseUpdateItem export const handler = { fetchOptions: { - query: checkoutLineItemUpdateMutation, + query: cartLineItemUpdateMutation, }, async fetcher({ input: { itemId, item }, @@ -46,13 +48,13 @@ export const handler = { message: 'The item quantity has to be a valid integer', }) } - const { checkoutLineItemsUpdate } = await fetch< - Mutation, - MutationCheckoutLineItemsUpdateArgs + const { cartLinesUpdate } = await fetch< + CartLinesUpdateMutation, + CartLinesUpdateMutationVariables >({ ...options, variables: { - checkoutId: getCheckoutId(), + checkoutId: getCartId(), lineItems: [ { id: itemId, @@ -62,44 +64,44 @@ export const handler = { }, }) - return checkoutToCart(checkoutLineItemsUpdate) + return normalizeCart(cartLinesUpdate?.cart) }, - useHook: ({ fetch }: MutationHookContext) => < - T extends LineItem | undefined = undefined - >( - ctx: { - item?: T - wait?: number - } = {} - ) => { - const { item } = ctx - const { mutate } = useCart() as any + useHook: + ({ fetch }: MutationHookContext) => + ( + ctx: { + item?: T + wait?: number + } = {} + ) => { + const { item } = ctx + const { mutate } = useCart() as any - return useCallback( - debounce(async (input: UpdateItemActionInput) => { - const itemId = input.id ?? item?.id - const productId = input.productId ?? item?.productId - const variantId = input.productId ?? item?.variantId - if (!itemId || !productId || !variantId) { - throw new ValidationError({ - message: 'Invalid input used for this operation', - }) - } + return useCallback( + debounce(async (input: UpdateItemActionInput) => { + const itemId = input.id ?? item?.id + const productId = input.productId ?? item?.productId + const variantId = input.productId ?? item?.variantId + if (!itemId || !productId || !variantId) { + throw new ValidationError({ + message: 'Invalid input used for this operation', + }) + } - const data = await fetch({ - input: { - item: { - productId, - variantId, - quantity: input.quantity, + const data = await fetch({ + input: { + item: { + productId, + variantId, + quantity: input.quantity, + }, + itemId, }, - itemId, - }, - }) - await mutate(data, false) - return data - }, ctx.wait ?? 500), - [fetch, mutate] - ) - }, + }) + await mutate(data, false) + return data + }, ctx.wait ?? 500), + [fetch, mutate] + ) + }, } diff --git a/framework/shopify/codegen.json b/framework/shopify/codegen.json index 9d7dcf8a9..861defa28 100644 --- a/framework/shopify/codegen.json +++ b/framework/shopify/codegen.json @@ -1,6 +1,6 @@ { "schema": { - "https://${NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN}/api/2021-07/graphql.json": { + "https://${NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN}/api/unstable/graphql.json": { "headers": { "X-Shopify-Storefront-Access-Token": "${NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN}" } diff --git a/framework/shopify/const.ts b/framework/shopify/const.ts index 06fbe5054..07de5a8aa 100644 --- a/framework/shopify/const.ts +++ b/framework/shopify/const.ts @@ -8,6 +8,8 @@ export const STORE_DOMAIN = process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN export const SHOPIFY_COOKIE_EXPIRE = 30 -export const API_URL = `https://${STORE_DOMAIN}/api/2021-01/graphql.json` +export const API_URL = `https://${STORE_DOMAIN}/api/unstable/graphql.json` export const API_TOKEN = process.env.NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN + +export const SHOPIFY_CART_ID_COOKIE = 'shopify_cartId' diff --git a/framework/shopify/index.tsx b/framework/shopify/index.tsx index 46ed106c5..c95052b95 100644 --- a/framework/shopify/index.tsx +++ b/framework/shopify/index.tsx @@ -9,14 +9,14 @@ import { import { shopifyProvider } from './provider' import type { ShopifyProvider } from './provider' -import { SHOPIFY_CHECKOUT_ID_COOKIE } from './const' +import { SHOPIFY_CART_ID_COOKIE } from './const' export { shopifyProvider } export type { ShopifyProvider } export const shopifyConfig: CommerceConfig = { locale: 'en-us', - cartCookie: SHOPIFY_CHECKOUT_ID_COOKIE, + cartCookie: SHOPIFY_CART_ID_COOKIE, } export type ShopifyConfig = Partial diff --git a/framework/shopify/provider.ts b/framework/shopify/provider.ts index 00db5c1d3..bfa102ac8 100644 --- a/framework/shopify/provider.ts +++ b/framework/shopify/provider.ts @@ -1,4 +1,4 @@ -import { SHOPIFY_CHECKOUT_ID_COOKIE } from './const' +import { SHOPIFY_CART_ID_COOKIE } from './const' import { handler as useCart } from './cart/use-cart' import { handler as useAddItem } from './cart/use-add-item' @@ -16,7 +16,7 @@ import fetcher from './fetcher' export const shopifyProvider = { locale: 'en-us', - cartCookie: SHOPIFY_CHECKOUT_ID_COOKIE, + cartCookie: SHOPIFY_CART_ID_COOKIE, fetcher, cart: { useCart, useAddItem, useUpdateItem, useRemoveItem }, customer: { useCustomer }, diff --git a/framework/shopify/schema.d.ts b/framework/shopify/schema.d.ts index 328f0ff1b..f8a929652 100644 --- a/framework/shopify/schema.d.ts +++ b/framework/shopify/schema.d.ts @@ -19,6 +19,8 @@ export type Scalars = { Decimal: any /** A string containing HTML code. Example value: `"

Grey cotton knit sweater.

"`. */ HTML: any + /** A JSON Object. Example value: `{ "key1": "Value 1", "key2": "Value 2", "key3": 3 }` */ + JSON: any /** A monetary value string. Example value: `"100.57"`. */ Money: any /** @@ -67,44 +69,49 @@ export type AppliedGiftCard = Node & { } /** An article in an online store blog. */ -export type Article = Node & { - __typename?: 'Article' - /** - * The article's author. - * @deprecated Use `authorV2` instead - */ - author: ArticleAuthor - /** The article's author. */ - authorV2?: Maybe - /** The blog that the article belongs to. */ - blog: Blog - /** List of comments posted on the article. */ - comments: CommentConnection - /** Stripped content of the article, single line with HTML tags removed. */ - content: Scalars['String'] - /** The content of the article, complete with HTML formatting. */ - contentHtml: Scalars['HTML'] - /** Stripped excerpt of the article, single line with HTML tags removed. */ - excerpt?: Maybe - /** The excerpt of the article, complete with HTML formatting. */ - excerptHtml?: Maybe - /** A human-friendly unique string for the Article automatically generated from its title. */ - handle: Scalars['String'] - /** Globally unique identifier. */ - id: Scalars['ID'] - /** The image associated with the article. */ - image?: Maybe - /** The date and time when the article was published. */ - publishedAt: Scalars['DateTime'] - /** The article’s SEO information. */ - seo?: Maybe - /** A categorization that a article can be tagged with. */ - tags: Array - /** The article’s name. */ - title: Scalars['String'] - /** The url pointing to the article accessible from the web. */ - url: Scalars['URL'] -} +export type Article = Node & + HasMetafields & { + __typename?: 'Article' + /** + * The article's author. + * @deprecated Use `authorV2` instead + */ + author: ArticleAuthor + /** The article's author. */ + authorV2?: Maybe + /** The blog that the article belongs to. */ + blog: Blog + /** List of comments posted on the article. */ + comments: CommentConnection + /** Stripped content of the article, single line with HTML tags removed. */ + content: Scalars['String'] + /** The content of the article, complete with HTML formatting. */ + contentHtml: Scalars['HTML'] + /** Stripped excerpt of the article, single line with HTML tags removed. */ + excerpt?: Maybe + /** The excerpt of the article, complete with HTML formatting. */ + excerptHtml?: Maybe + /** A human-friendly unique string for the Article automatically generated from its title. */ + handle: Scalars['String'] + /** Globally unique identifier. */ + id: Scalars['ID'] + /** The image associated with the article. */ + image?: Maybe + /** Returns a metafield found by namespace and key. */ + metafield?: Maybe + /** A paginated list of metafields associated with the resource. */ + metafields: MetafieldConnection + /** The date and time when the article was published. */ + publishedAt: Scalars['DateTime'] + /** The article’s SEO information. */ + seo?: Maybe + /** A categorization that a article can be tagged with. */ + tags: Array + /** The article’s name. */ + title: Scalars['String'] + /** The url pointing to the article accessible from the web. */ + url: Scalars['URL'] + } /** An article in an online store blog. */ export type ArticleCommentsArgs = { @@ -133,6 +140,22 @@ export type ArticleImageArgs = { scale?: Maybe } +/** An article in an online store blog. */ +export type ArticleMetafieldArgs = { + namespace: Scalars['String'] + key: Scalars['String'] +} + +/** An article in an online store blog. */ +export type ArticleMetafieldsArgs = { + namespace?: Maybe + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** The author of an article. */ export type ArticleAuthor = { __typename?: 'ArticleAuthor' @@ -234,25 +257,30 @@ export type AvailableShippingRates = { } /** An online store blog. */ -export type Blog = Node & { - __typename?: 'Blog' - /** Find an article by its handle. */ - articleByHandle?: Maybe
- /** List of the blog's articles. */ - articles: ArticleConnection - /** The authors who have contributed to the blog. */ - authors: Array - /** A human-friendly unique string for the Blog automatically generated from its title. */ - handle: Scalars['String'] - /** Globally unique identifier. */ - id: Scalars['ID'] - /** The blog's SEO information. */ - seo?: Maybe - /** The blogs’s title. */ - title: Scalars['String'] - /** The url pointing to the blog accessible from the web. */ - url: Scalars['URL'] -} +export type Blog = Node & + HasMetafields & { + __typename?: 'Blog' + /** Find an article by its handle. */ + articleByHandle?: Maybe
+ /** List of the blog's articles. */ + articles: ArticleConnection + /** The authors who have contributed to the blog. */ + authors: Array + /** A human-friendly unique string for the Blog automatically generated from its title. */ + handle: Scalars['String'] + /** Globally unique identifier. */ + id: Scalars['ID'] + /** Returns a metafield found by namespace and key. */ + metafield?: Maybe + /** A paginated list of metafields associated with the resource. */ + metafields: MetafieldConnection + /** The blog's SEO information. */ + seo?: Maybe + /** The blogs’s title. */ + title: Scalars['String'] + /** The url pointing to the blog accessible from the web. */ + url: Scalars['URL'] + } /** An online store blog. */ export type BlogArticleByHandleArgs = { @@ -270,6 +298,22 @@ export type BlogArticlesArgs = { query?: Maybe } +/** An online store blog. */ +export type BlogMetafieldArgs = { + namespace: Scalars['String'] + key: Scalars['String'] +} + +/** An online store blog. */ +export type BlogMetafieldsArgs = { + namespace?: Maybe + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** An auto-generated type for paginating through multiple Blogs. */ export type BlogConnection = { __typename?: 'BlogConnection' @@ -318,6 +362,296 @@ export enum CardBrand { DinersClub = 'DINERS_CLUB', /** JCB. */ Jcb = 'JCB', + /** UnionPay. */ + Unionpay = 'UNIONPAY', + /** Elo. */ + Elo = 'ELO', +} + +/** A cart represents the merchandise that a buyer intends to purchase, and the estimated cost associated with the cart. */ +export type Cart = Node & { + __typename?: 'Cart' + /** The attributes associated with the cart. Attributes are represented as key-value pairs. */ + attributes: Array + /** Information about the buyer that is interacting with the cart. */ + buyerIdentity: CartBuyerIdentity + /** The URL of the checkout for the cart. */ + checkoutUrl: Scalars['URL'] + /** The date and time when the cart was created. */ + createdAt: Scalars['DateTime'] + /** The discount codes that have been applied to the cart. */ + discountCodes: Array + /** The estimated costs that the buyer will pay at checkout. */ + estimatedCost: CartEstimatedCost + /** Globally unique identifier. */ + id: Scalars['ID'] + /** A list of lines containing information about the items the customer intends to purchase. */ + lines: CartLineConnection + /** A note that is associated with the cart. For example, the note can be a personalized message to the buyer. */ + note?: Maybe + /** The date and time when the cart was updated. */ + updatedAt: Scalars['DateTime'] +} + +/** A cart represents the merchandise that a buyer intends to purchase, and the estimated cost associated with the cart. */ +export type CartLinesArgs = { + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + +/** Return type for `cartAttributesUpdate` mutation. */ +export type CartAttributesUpdatePayload = { + __typename?: 'CartAttributesUpdatePayload' + /** The updated cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** The discounts automatically applied to the cart line based on prerequisites that have been met. */ +export type CartAutomaticDiscountAllocation = CartDiscountAllocation & { + __typename?: 'CartAutomaticDiscountAllocation' + /** The discounted amount that has been applied to the cart line. */ + discountedAmount: MoneyV2 + /** The title of the allocated discount. */ + title: Scalars['String'] +} + +/** Represents information about the buyer that is interacting with the cart. */ +export type CartBuyerIdentity = { + __typename?: 'CartBuyerIdentity' + /** The country where the buyer is located. */ + countryCode?: Maybe + /** The customer account associated with the cart. */ + customer?: Maybe + /** The email address of the buyer that is interacting with the cart. */ + email?: Maybe + /** The phone number of the buyer that is interacting with the cart. */ + phone?: Maybe +} + +/** Specifies the input fields to update the buyer information associated with a cart. */ +export type CartBuyerIdentityInput = { + /** The email address of the buyer that is interacting with the cart. */ + email?: Maybe + /** The phone number of the buyer that is interacting with the cart. */ + phone?: Maybe + /** The country where the buyer is located. */ + countryCode?: Maybe + /** The access token used to identify the customer associated with the cart. */ + customerAccessToken?: Maybe +} + +/** Return type for `cartBuyerIdentityUpdate` mutation. */ +export type CartBuyerIdentityUpdatePayload = { + __typename?: 'CartBuyerIdentityUpdatePayload' + /** The updated cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** The discount that has been applied to the cart line using a discount code. */ +export type CartCodeDiscountAllocation = CartDiscountAllocation & { + __typename?: 'CartCodeDiscountAllocation' + /** The code used to apply the discount. */ + code: Scalars['String'] + /** The discounted amount that has been applied to the cart line. */ + discountedAmount: MoneyV2 +} + +/** Return type for `cartCreate` mutation. */ +export type CartCreatePayload = { + __typename?: 'CartCreatePayload' + /** The new cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** The discounts that have been applied to the cart line. */ +export type CartDiscountAllocation = { + /** The discounted amount that has been applied to the cart line. */ + discountedAmount: MoneyV2 +} + +/** The discount codes applied to the cart. */ +export type CartDiscountCode = { + __typename?: 'CartDiscountCode' + /** The code for the discount. */ + code: Scalars['String'] +} + +/** Return type for `cartDiscountCodesUpdate` mutation. */ +export type CartDiscountCodesUpdatePayload = { + __typename?: 'CartDiscountCodesUpdatePayload' + /** The updated cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** Possible error codes that could be returned by CartUserError. */ +export enum CartErrorCode { + /** The input value is invalid. */ + Invalid = 'INVALID', + /** The input value should be less than the maximum value allowed. */ + LessThan = 'LESS_THAN', + /** Merchandise line was not found in cart. */ + InvalidMerchandiseLine = 'INVALID_MERCHANDISE_LINE', + /** Missing discount code. */ + MissingDiscountCode = 'MISSING_DISCOUNT_CODE', + /** Missing note. */ + MissingNote = 'MISSING_NOTE', +} + +/** The estimated costs that the buyer will pay at checkout. */ +export type CartEstimatedCost = { + __typename?: 'CartEstimatedCost' + /** The estimated amount, before taxes and discounts, for the customer to pay at checkout. */ + subtotalAmount: MoneyV2 + /** The estimated total amount for the customer to pay at checkout. */ + totalAmount: MoneyV2 + /** The estimated duty amount for the customer to pay at checkout. */ + totalDutyAmount?: Maybe + /** The estimated tax amount for the customer to pay at checkout. */ + totalTaxAmount?: Maybe +} + +/** Specifies the input fields to create a cart. */ +export type CartInput = { + /** An array of key-value pairs that contains additional information about the cart. */ + attributes?: Maybe> + /** A list of merchandise lines to add to the cart. */ + lines?: Maybe> + /** The discount codes to apply to the cart. */ + discountCodes?: Maybe> + /** A note that is associated with the cart. For example, the note can be a personalized message to the buyer. */ + note?: Maybe + /** The customer associated with the cart. */ + buyerIdentity?: Maybe +} + +/** Represents information about the merchandise in the cart. */ +export type CartLine = Node & { + __typename?: 'CartLine' + /** The attributes associated with the cart line. Attributes are represented as key-value pairs. */ + attributes: Array + /** The discounts that have been applied to the cart line. */ + discountAllocations: Array + /** The estimated cost of the merchandise that the buyer will pay for at checkout. */ + estimatedCost: CartLineEstimatedCost + /** Globally unique identifier. */ + id: Scalars['ID'] + /** The merchandise that the buyer intends to purchase. */ + merchandise: Merchandise + /** The quantity of the merchandise that the customer intends to purchase. */ + quantity: Scalars['Int'] + /** The selling plan associated with the cart line and the effect that each selling plan has on variants when they're purchased. */ + sellingPlanAllocation?: Maybe +} + +/** An auto-generated type for paginating through multiple CartLines. */ +export type CartLineConnection = { + __typename?: 'CartLineConnection' + /** A list of edges. */ + edges: Array + /** Information to aid in pagination. */ + pageInfo: PageInfo +} + +/** An auto-generated type which holds one CartLine and a cursor during pagination. */ +export type CartLineEdge = { + __typename?: 'CartLineEdge' + /** A cursor for use in pagination. */ + cursor: Scalars['String'] + /** The item at the end of CartLineEdge. */ + node: CartLine +} + +/** The estimated cost of the merchandise line that the buyer will pay at checkout. */ +export type CartLineEstimatedCost = { + __typename?: 'CartLineEstimatedCost' + /** The estimated cost of the merchandise line before discounts. */ + subtotalAmount: MoneyV2 + /** The estimated total cost of the merchandise line, without discounts. */ + totalAmount: MoneyV2 +} + +/** Specifies the input fields to create a merchandise line on a cart. */ +export type CartLineInput = { + /** An array of key-value pairs that contains additional information about the merchandise line. */ + attributes?: Maybe> + /** The quantity of the merchandise. */ + quantity?: Maybe + /** The identifier of the merchandise that the buyer intends to purchase. */ + merchandiseId: Scalars['ID'] + /** The identifier of the selling plan that the merchandise is being purchased with. */ + sellingPlanId?: Maybe +} + +/** Specifies the input fields to update a line item on a cart. */ +export type CartLineUpdateInput = { + /** An array of key-value pairs that contains additional information about the merchandise line. */ + attributes?: Maybe> + /** The quantity of the line item. */ + quantity?: Maybe + /** The identifier of the merchandise for the line item. */ + merchandiseId?: Maybe + /** The identifier of the selling plan that the merchandise is being purchased with. */ + sellingPlanId?: Maybe + /** The identifier of the merchandise line. */ + id?: Maybe +} + +/** Return type for `cartLinesAdd` mutation. */ +export type CartLinesAddPayload = { + __typename?: 'CartLinesAddPayload' + /** The updated cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** Return type for `cartLinesRemove` mutation. */ +export type CartLinesRemovePayload = { + __typename?: 'CartLinesRemovePayload' + /** The updated cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** Return type for `cartLinesUpdate` mutation. */ +export type CartLinesUpdatePayload = { + __typename?: 'CartLinesUpdatePayload' + /** The updated cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** Return type for `cartNoteUpdate` mutation. */ +export type CartNoteUpdatePayload = { + __typename?: 'CartNoteUpdatePayload' + /** The updated cart. */ + cart?: Maybe + /** The list of errors that occurred from executing the mutation. */ + userErrors: Array +} + +/** Represents an error that happens during execution of a cart mutation. */ +export type CartUserError = DisplayableError & { + __typename?: 'CartUserError' + /** The error code. */ + code?: Maybe + /** The path to the input field that caused the error. */ + field?: Maybe> + /** The error message. */ + message: Scalars['String'] } /** A container for all the information required to checkout items and pay. */ @@ -331,6 +665,8 @@ export type Checkout = Node & { * the shipping address is valid. */ availableShippingRates?: Maybe + /** The identity of the customer associated with the checkout. */ + buyerIdentity: CheckoutBuyerIdentity /** The date and time when the checkout was completed. */ completedAt?: Maybe /** The date and time when the checkout was created. */ @@ -393,6 +729,8 @@ export type Checkout = Node & { taxExempt: Scalars['Boolean'] /** Specifies if taxes are included in the line item and shipping line prices. */ taxesIncluded: Scalars['Boolean'] + /** The sum of all the duties applied to the line items in the checkout. */ + totalDuties?: Maybe /** * The sum of all the prices of all the items in the checkout, taxes and discounts included. * @deprecated Use `totalPriceV2` instead @@ -440,7 +778,8 @@ export type CheckoutAttributesUpdateInput = { /** * Allows setting partial addresses on a Checkout, skipping the full validation of attributes. * The required attributes are city, province, and country. - * Full validation of the addresses is still done at complete time. + * Full validation of the addresses is still done at completion time. Defaults to `false` with + * each operation. */ allowPartialAddresses?: Maybe } @@ -450,10 +789,10 @@ export type CheckoutAttributesUpdatePayload = { __typename?: 'CheckoutAttributesUpdatePayload' /** The updated checkout object. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -468,7 +807,8 @@ export type CheckoutAttributesUpdateV2Input = { /** * Allows setting partial addresses on a Checkout, skipping the full validation of attributes. * The required attributes are city, province, and country. - * Full validation of the addresses is still done at complete time. + * Full validation of the addresses is still done at completion time. Defaults to `false` with + * each operation. */ allowPartialAddresses?: Maybe } @@ -478,24 +818,41 @@ export type CheckoutAttributesUpdateV2Payload = { __typename?: 'CheckoutAttributesUpdateV2Payload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array } +/** The identity of the customer associated with the checkout. */ +export type CheckoutBuyerIdentity = { + __typename?: 'CheckoutBuyerIdentity' + /** The country code for the checkout. For example, `CA`. */ + countryCode?: Maybe +} + +/** Specifies the identity of the customer associated with the checkout. */ +export type CheckoutBuyerIdentityInput = { + /** + * The country code of one of the shop's + * [enabled countries](https://help.shopify.com/en/manual/payments/shopify-payments/multi-currency/setup). + * For example, `CA`. Including this field creates a checkout in the specified country's currency. + */ + countryCode: CountryCode +} + /** Return type for `checkoutCompleteFree` mutation. */ export type CheckoutCompleteFreePayload = { __typename?: 'CheckoutCompleteFreePayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -506,12 +863,12 @@ export type CheckoutCompleteWithCreditCardPayload = { __typename?: 'CheckoutCompleteWithCreditCardPayload' /** The checkout on which the payment was applied. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** A representation of the attempted payment. */ payment?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -522,12 +879,12 @@ export type CheckoutCompleteWithCreditCardV2Payload = { __typename?: 'CheckoutCompleteWithCreditCardV2Payload' /** The checkout on which the payment was applied. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** A representation of the attempted payment. */ payment?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -538,12 +895,12 @@ export type CheckoutCompleteWithTokenizedPaymentPayload = { __typename?: 'CheckoutCompleteWithTokenizedPaymentPayload' /** The checkout on which the payment was applied. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** A representation of the attempted payment. */ payment?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -554,12 +911,12 @@ export type CheckoutCompleteWithTokenizedPaymentV2Payload = { __typename?: 'CheckoutCompleteWithTokenizedPaymentV2Payload' /** The checkout on which the payment was applied. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** A representation of the attempted payment. */ payment?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -570,12 +927,12 @@ export type CheckoutCompleteWithTokenizedPaymentV3Payload = { __typename?: 'CheckoutCompleteWithTokenizedPaymentV3Payload' /** The checkout on which the payment was applied. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** A representation of the attempted payment. */ payment?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -596,15 +953,18 @@ export type CheckoutCreateInput = { /** * Allows setting partial addresses on a Checkout, skipping the full validation of attributes. * The required attributes are city, province, and country. - * Full validation of addresses is still done at complete time. + * Full validation of addresses is still done at completion time. Defaults to `null`. */ allowPartialAddresses?: Maybe /** * The three-letter currency code of one of the shop's enabled presentment currencies. * Including this field creates a checkout in the specified currency. By default, new * checkouts are created in the shop's primary currency. + * This argument is deprecated: Use `country` field instead. */ presentmentCurrencyCode?: Maybe + /** The identity of the customer associated with the checkout. */ + buyerIdentity?: Maybe } /** Return type for `checkoutCreate` mutation. */ @@ -612,10 +972,12 @@ export type CheckoutCreatePayload = { __typename?: 'CheckoutCreatePayload' /** The new checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array + /** The checkout queue token. */ + queueToken?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -628,7 +990,7 @@ export type CheckoutCustomerAssociatePayload = { checkout: Checkout /** The associated customer object. */ customer?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ userErrors: Array } @@ -637,12 +999,12 @@ export type CheckoutCustomerAssociateV2Payload = { __typename?: 'CheckoutCustomerAssociateV2Payload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** The associated customer object. */ customer?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -653,10 +1015,10 @@ export type CheckoutCustomerDisassociatePayload = { __typename?: 'CheckoutCustomerDisassociatePayload' /** The updated checkout object. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -667,10 +1029,10 @@ export type CheckoutCustomerDisassociateV2Payload = { __typename?: 'CheckoutCustomerDisassociateV2Payload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -681,10 +1043,10 @@ export type CheckoutDiscountCodeApplyPayload = { __typename?: 'CheckoutDiscountCodeApplyPayload' /** The updated checkout object. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -695,10 +1057,10 @@ export type CheckoutDiscountCodeApplyV2Payload = { __typename?: 'CheckoutDiscountCodeApplyV2Payload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -709,10 +1071,10 @@ export type CheckoutDiscountCodeRemovePayload = { __typename?: 'CheckoutDiscountCodeRemovePayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -723,10 +1085,10 @@ export type CheckoutEmailUpdatePayload = { __typename?: 'CheckoutEmailUpdatePayload' /** The checkout object with the updated email. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -737,10 +1099,10 @@ export type CheckoutEmailUpdateV2Payload = { __typename?: 'CheckoutEmailUpdateV2Payload' /** The checkout object with the updated email. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -748,19 +1110,19 @@ export type CheckoutEmailUpdateV2Payload = { /** Possible error codes that could be returned by CheckoutUserError. */ export enum CheckoutErrorCode { - /** Input value is blank. */ + /** The input value is blank. */ Blank = 'BLANK', - /** Input value is invalid. */ + /** The input value is invalid. */ Invalid = 'INVALID', - /** Input value is too long. */ + /** The input value is too long. */ TooLong = 'TOO_LONG', - /** Input value is not present. */ + /** The input value needs to be blank. */ Present = 'PRESENT', - /** Input value should be less than maximum allowed value. */ + /** The input value should be less than the maximum value allowed. */ LessThan = 'LESS_THAN', - /** Input value should be greater than or equal to minimum allowed value. */ + /** The input value should be greater than or equal to the minimum value allowed. */ GreaterThanOrEqualTo = 'GREATER_THAN_OR_EQUAL_TO', - /** Input value should be less or equal to maximum allowed value. */ + /** The input value should be less than or equal to the maximum value allowed. */ LessThanOrEqualTo = 'LESS_THAN_OR_EQUAL_TO', /** Checkout is already completed. */ AlreadyCompleted = 'ALREADY_COMPLETED', @@ -824,6 +1186,14 @@ export enum CheckoutErrorCode { UnableToApply = 'UNABLE_TO_APPLY', /** Discount already applied. */ DiscountAlreadyApplied = 'DISCOUNT_ALREADY_APPLIED', + /** Throttled during checkout. */ + ThrottledDuringCheckout = 'THROTTLED_DURING_CHECKOUT', + /** Queue token has expired. */ + ExpiredQueueToken = 'EXPIRED_QUEUE_TOKEN', + /** Queue token is invalid. */ + InvalidQueueToken = 'INVALID_QUEUE_TOKEN', + /** Cannot specify country and presentment currency code. */ + InvalidCountryAndCurrency = 'INVALID_COUNTRY_AND_CURRENCY', } /** Return type for `checkoutGiftCardApply` mutation. */ @@ -831,10 +1201,10 @@ export type CheckoutGiftCardApplyPayload = { __typename?: 'CheckoutGiftCardApplyPayload' /** The updated checkout object. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -845,10 +1215,10 @@ export type CheckoutGiftCardRemovePayload = { __typename?: 'CheckoutGiftCardRemovePayload' /** The updated checkout object. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -859,10 +1229,10 @@ export type CheckoutGiftCardRemoveV2Payload = { __typename?: 'CheckoutGiftCardRemoveV2Payload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -873,10 +1243,10 @@ export type CheckoutGiftCardsAppendPayload = { __typename?: 'CheckoutGiftCardsAppendPayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -946,10 +1316,10 @@ export type CheckoutLineItemsAddPayload = { __typename?: 'CheckoutLineItemsAddPayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -960,10 +1330,10 @@ export type CheckoutLineItemsRemovePayload = { __typename?: 'CheckoutLineItemsRemovePayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -974,7 +1344,7 @@ export type CheckoutLineItemsReplacePayload = { __typename?: 'CheckoutLineItemsReplacePayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ userErrors: Array } @@ -983,10 +1353,10 @@ export type CheckoutLineItemsUpdatePayload = { __typename?: 'CheckoutLineItemsUpdatePayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -997,10 +1367,10 @@ export type CheckoutShippingAddressUpdatePayload = { __typename?: 'CheckoutShippingAddressUpdatePayload' /** The updated checkout object. */ checkout: Checkout - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -1011,10 +1381,10 @@ export type CheckoutShippingAddressUpdateV2Payload = { __typename?: 'CheckoutShippingAddressUpdateV2Payload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -1025,10 +1395,10 @@ export type CheckoutShippingLineUpdatePayload = { __typename?: 'CheckoutShippingLineUpdatePayload' /** The updated checkout object. */ checkout?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ checkoutUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `checkoutUserErrors` instead */ userErrors: Array @@ -1037,37 +1407,42 @@ export type CheckoutShippingLineUpdatePayload = { /** Represents an error that happens during execution of a checkout mutation. */ export type CheckoutUserError = DisplayableError & { __typename?: 'CheckoutUserError' - /** Error code to uniquely identify the error. */ + /** The error code. */ code?: Maybe - /** Path to the input field which caused the error. */ + /** The path to the input field that caused the error. */ field?: Maybe> /** The error message. */ message: Scalars['String'] } /** A collection represents a grouping of products that a shop owner can create to organize them or make their shops easier to browse. */ -export type Collection = Node & { - __typename?: 'Collection' - /** Stripped description of the collection, single line with HTML tags removed. */ - description: Scalars['String'] - /** The description of the collection, complete with HTML formatting. */ - descriptionHtml: Scalars['HTML'] - /** - * A human-friendly unique string for the collection automatically generated from its title. - * Limit of 255 characters. - */ - handle: Scalars['String'] - /** Globally unique identifier. */ - id: Scalars['ID'] - /** Image associated with the collection. */ - image?: Maybe - /** List of products in the collection. */ - products: ProductConnection - /** The collection’s name. Limit of 255 characters. */ - title: Scalars['String'] - /** The date and time when the collection was last modified. */ - updatedAt: Scalars['DateTime'] -} +export type Collection = Node & + HasMetafields & { + __typename?: 'Collection' + /** Stripped description of the collection, single line with HTML tags removed. */ + description: Scalars['String'] + /** The description of the collection, complete with HTML formatting. */ + descriptionHtml: Scalars['HTML'] + /** + * A human-friendly unique string for the collection automatically generated from its title. + * Limit of 255 characters. + */ + handle: Scalars['String'] + /** Globally unique identifier. */ + id: Scalars['ID'] + /** Image associated with the collection. */ + image?: Maybe + /** Returns a metafield found by namespace and key. */ + metafield?: Maybe + /** A paginated list of metafields associated with the resource. */ + metafields: MetafieldConnection + /** List of products in the collection. */ + products: ProductConnection + /** The collection’s name. Limit of 255 characters. */ + title: Scalars['String'] + /** The date and time when the collection was last modified. */ + updatedAt: Scalars['DateTime'] + } /** A collection represents a grouping of products that a shop owner can create to organize them or make their shops easier to browse. */ export type CollectionDescriptionArgs = { @@ -1082,6 +1457,22 @@ export type CollectionImageArgs = { scale?: Maybe } +/** A collection represents a grouping of products that a shop owner can create to organize them or make their shops easier to browse. */ +export type CollectionMetafieldArgs = { + namespace: Scalars['String'] + key: Scalars['String'] +} + +/** A collection represents a grouping of products that a shop owner can create to organize them or make their shops easier to browse. */ +export type CollectionMetafieldsArgs = { + namespace?: Maybe + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** A collection represents a grouping of products that a shop owner can create to organize them or make their shops easier to browse. */ export type CollectionProductsArgs = { first?: Maybe @@ -1090,6 +1481,7 @@ export type CollectionProductsArgs = { before?: Maybe reverse?: Maybe sortKey?: Maybe + filters?: Maybe> } /** An auto-generated type for paginating through multiple Collections. */ @@ -1171,6 +1563,19 @@ export type CommentEdge = { node: Comment } +/** A country. */ +export type Country = { + __typename?: 'Country' + /** The currency of the country. */ + currency: Currency + /** The ISO code of the country. */ + isoCode: CountryCode + /** The name of the country. */ + name: Scalars['String'] + /** The unit system used in the country. */ + unitSystem: UnitSystem +} + /** ISO 3166-1 alpha-2 country codes with some differences. */ export enum CountryCode { /** Afghanistan. */ @@ -1661,6 +2066,8 @@ export enum CountryCode { Zm = 'ZM', /** Zimbabwe. */ Zw = 'ZW', + /** Unknown Region. */ + Zz = 'ZZ', } /** Credit card information used for a payment. */ @@ -1732,6 +2139,17 @@ export enum CropRegion { Right = 'RIGHT', } +/** A currency. */ +export type Currency = { + __typename?: 'Currency' + /** The ISO code of the currency. */ + isoCode: CurrencyCode + /** The name of the currency. */ + name: Scalars['String'] + /** The symbol of the currency. */ + symbol: Scalars['String'] +} + /** Currency codes. */ export enum CurrencyCode { /** United States Dollars (USD). */ @@ -2050,10 +2468,12 @@ export enum CurrencyCode { Vef = 'VEF', /** Venezuelan Bolivares (VES). */ Ves = 'VES', + /** Unrecognized currency. */ + Xxx = 'XXX', } /** A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout. */ -export type Customer = { +export type Customer = HasMetafields & { __typename?: 'Customer' /** Indicates whether the customer has consented to be sent marketing material via email. */ acceptsMarketing: Scalars['Boolean'] @@ -2075,6 +2495,10 @@ export type Customer = { lastIncompleteCheckout?: Maybe /** The customer’s last name. */ lastName?: Maybe + /** Returns a metafield found by namespace and key. */ + metafield?: Maybe + /** A paginated list of metafields associated with the resource. */ + metafields: MetafieldConnection /** The orders associated with the customer. */ orders: OrderConnection /** The customer’s phone number. */ @@ -2097,6 +2521,22 @@ export type CustomerAddressesArgs = { reverse?: Maybe } +/** A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout. */ +export type CustomerMetafieldArgs = { + namespace: Scalars['String'] + key: Scalars['String'] +} + +/** A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout. */ +export type CustomerMetafieldsArgs = { + namespace?: Maybe + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout. */ export type CustomerOrdersArgs = { first?: Maybe @@ -2130,10 +2570,10 @@ export type CustomerAccessTokenCreatePayload = { __typename?: 'CustomerAccessTokenCreatePayload' /** The newly created customer access token object. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2144,7 +2584,7 @@ export type CustomerAccessTokenCreateWithMultipassPayload = { __typename?: 'CustomerAccessTokenCreateWithMultipassPayload' /** An access token object associated with the customer. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array } @@ -2155,7 +2595,7 @@ export type CustomerAccessTokenDeletePayload = { deletedAccessToken?: Maybe /** ID of the destroyed customer access token. */ deletedCustomerAccessTokenId?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ userErrors: Array } @@ -2164,7 +2604,7 @@ export type CustomerAccessTokenRenewPayload = { __typename?: 'CustomerAccessTokenRenewPayload' /** The renewed customer access token object. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ userErrors: Array } @@ -2175,7 +2615,7 @@ export type CustomerActivateByUrlPayload = { customer?: Maybe /** A new customer access token for the customer. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array } @@ -2194,10 +2634,10 @@ export type CustomerActivatePayload = { customer?: Maybe /** A newly created customer access token object for the customer. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2208,10 +2648,10 @@ export type CustomerAddressCreatePayload = { __typename?: 'CustomerAddressCreatePayload' /** The new customer address object. */ customerAddress?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2220,12 +2660,12 @@ export type CustomerAddressCreatePayload = { /** Return type for `customerAddressDelete` mutation. */ export type CustomerAddressDeletePayload = { __typename?: 'CustomerAddressDeletePayload' - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** ID of the deleted customer address. */ deletedCustomerAddressId?: Maybe /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2236,10 +2676,10 @@ export type CustomerAddressUpdatePayload = { __typename?: 'CustomerAddressUpdatePayload' /** The customer’s updated mailing address. */ customerAddress?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2270,10 +2710,10 @@ export type CustomerCreatePayload = { __typename?: 'CustomerCreatePayload' /** The created customer object. */ customer?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2284,10 +2724,10 @@ export type CustomerDefaultAddressUpdatePayload = { __typename?: 'CustomerDefaultAddressUpdatePayload' /** The updated customer object. */ customer?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2295,15 +2735,15 @@ export type CustomerDefaultAddressUpdatePayload = { /** Possible error codes that could be returned by CustomerUserError. */ export enum CustomerErrorCode { - /** Input value is blank. */ + /** The input value is blank. */ Blank = 'BLANK', - /** Input value is invalid. */ + /** The input value is invalid. */ Invalid = 'INVALID', - /** Input value is already taken. */ + /** The input value is already taken. */ Taken = 'TAKEN', - /** Input value is too long. */ + /** The input value is too long. */ TooLong = 'TOO_LONG', - /** Input value is too short. */ + /** The input value is too short. */ TooShort = 'TOO_SHORT', /** Unidentified customer. */ UnidentifiedCustomer = 'UNIDENTIFIED_CUSTOMER', @@ -2330,10 +2770,10 @@ export enum CustomerErrorCode { /** Return type for `customerRecover` mutation. */ export type CustomerRecoverPayload = { __typename?: 'CustomerRecoverPayload' - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2346,10 +2786,10 @@ export type CustomerResetByUrlPayload = { customer?: Maybe /** A newly created customer access token object for the customer. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2370,10 +2810,10 @@ export type CustomerResetPayload = { customer?: Maybe /** A newly created customer access token object for the customer. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2409,10 +2849,10 @@ export type CustomerUpdatePayload = { * (including the one used to perform this mutation) become invalid, and a new token is generated. */ customerAccessToken?: Maybe - /** List of errors that occurred executing the mutation. */ + /** The list of errors that occurred from executing the mutation. */ customerUserErrors: Array /** - * List of errors that occurred executing the mutation. + * The list of errors that occurred from executing the mutation. * @deprecated Use `customerUserErrors` instead */ userErrors: Array @@ -2421,9 +2861,9 @@ export type CustomerUpdatePayload = { /** Represents an error that happens during execution of a customer mutation. */ export type CustomerUserError = DisplayableError & { __typename?: 'CustomerUserError' - /** Error code to uniquely identify the error. */ + /** The error code. */ code?: Maybe - /** Path to the input field which caused the error. */ + /** The path to the input field that caused the error. */ field?: Maybe> /** The error message. */ message: Scalars['String'] @@ -2536,7 +2976,7 @@ export type DiscountCodeApplication = DiscountApplication & { /** Represents an error in the input of a mutation. */ export type DisplayableError = { - /** Path to the input field which caused the error. */ + /** The path to the input field that caused the error. */ field?: Maybe> /** The error message. */ message: Scalars['String'] @@ -2561,6 +3001,8 @@ export type ExternalVideo = Node & alt?: Maybe /** The URL. */ embeddedUrl: Scalars['URL'] + /** The host of the external video. */ + host: MediaHost /** Globally unique identifier. */ id: Scalars['ID'] /** The media content type. */ @@ -2569,6 +3011,40 @@ export type ExternalVideo = Node & previewImage?: Maybe } +/** A group of filters that are supported for the parent field. */ +export type FilterGroup = { + __typename?: 'FilterGroup' + /** A unique identifier. */ + id: Scalars['String'] + /** A human-friendly string for the filter group. */ + label: Scalars['String'] + /** An Enum that denotes the type of data this filter group represents. */ + type: FilterType + /** The list of options for this filter group. */ + values: Array +} + +/** Denotes the type of data this filter group represents. */ +export enum FilterType { + /** A list of selectable values. */ + List = 'LIST', + /** A range of prices. */ + PriceRange = 'PRICE_RANGE', +} + +/** A selectable option for a specific filter group. */ +export type FilterValue = { + __typename?: 'FilterValue' + /** A count of the number of objects matching this filter option. */ + count: Scalars['Int'] + /** The parameters used to select this option as a filter on the parent field. */ + filterParams: Scalars['JSON'] + /** A unique identifier. */ + id: Scalars['String'] + /** A human-friendly string for the filter group. */ + label: Scalars['String'] +} + /** Represents a single fulfillment in an order. */ export type Fulfillment = { __typename?: 'Fulfillment' @@ -2633,9 +3109,17 @@ export type FulfillmentTrackingInfo = { url?: Maybe } +/** Used to specify a geographical location. */ +export type GeoCoordinateInput = { + /** The coordinate's latitude value. */ + latitude: Scalars['Float'] + /** The coordinate's longitude value. */ + longitude: Scalars['Float'] +} + /** Represents information about the metafields associated to the specified resource. */ export type HasMetafields = { - /** The metafield associated with the resource. */ + /** Returns a metafield found by namespace and key. */ metafield?: Maybe /** A paginated list of metafields associated with the resource. */ metafields: MetafieldConnection @@ -2766,6 +3250,88 @@ export type ImageEdge = { node: Image } +/** Information about the localized experiences configured for the shop. */ +export type Localization = { + __typename?: 'Localization' + /** List of countries with enabled localized experiences. */ + availableCountries: Array + /** The country of the active localized experience. Use the `@inContext` directive to change this value. */ + country: Country +} + +/** Represents a location where product inventory is held. */ +export type Location = Node & { + __typename?: 'Location' + /** The address of the location. */ + address: LocationAddress + /** Globally unique identifier. */ + id: Scalars['ID'] + /** The name of the location. */ + name: Scalars['String'] +} + +/** Represents the address of the location. */ +export type LocationAddress = { + __typename?: 'LocationAddress' + /** The first line of the address for the location. */ + address1?: Maybe + /** The second line of the address for the location. */ + address2?: Maybe + /** The city of the location. */ + city?: Maybe + /** The country of the location. */ + country?: Maybe + /** The two-letter country code of the location. */ + countryCode?: Maybe + /** A formatted version of the location address. */ + formatted: Array + /** The latitude coordinates of the location. */ + latitude?: Maybe + /** The longitude coordinates of the location. */ + longitude?: Maybe + /** The phone number of the location. */ + phone?: Maybe + /** The province of the location. */ + province?: Maybe + /** + * The code for the region of the address, such as the province, state, or district. + * For example QC for Quebec, Canada. + */ + provinceCode?: Maybe + /** The ZIP code of the location. */ + zip?: Maybe +} + +/** An auto-generated type for paginating through multiple Locations. */ +export type LocationConnection = { + __typename?: 'LocationConnection' + /** A list of edges. */ + edges: Array + /** Information to aid in pagination. */ + pageInfo: PageInfo +} + +/** An auto-generated type which holds one Location and a cursor during pagination. */ +export type LocationEdge = { + __typename?: 'LocationEdge' + /** A cursor for use in pagination. */ + cursor: Scalars['String'] + /** The item at the end of LocationEdge. */ + node: Location +} + +/** The set of valid sort keys for the Location query. */ +export enum LocationSortKeys { + /** Sort by the `id` value. */ + Id = 'ID', + /** Sort by the `name` value. */ + Name = 'NAME', + /** Sort by the `city` value. */ + City = 'CITY', + /** Sort by the `distance` value. */ + Distance = 'DISTANCE', +} + /** Represents a mailing address for customers and shipping. */ export type MailingAddress = Node & { __typename?: 'MailingAddress' @@ -2935,6 +3501,14 @@ export type MediaEdge = { node: Media } +/** Host for a Media Resource. */ +export enum MediaHost { + /** Host for YouTube embedded videos. */ + Youtube = 'YOUTUBE', + /** Host for Vimeo embedded videos. */ + Vimeo = 'VIMEO', +} + /** Represents a Shopify hosted image. */ export type MediaImage = Node & Media & { @@ -2951,6 +3525,9 @@ export type MediaImage = Node & previewImage?: Maybe } +/** The merchandise to be purchased at checkout. */ +export type Merchandise = ProductVariant + /** * Metafields represent custom metadata attached to a resource. Metafields can be sorted into namespaces and are * comprised of keys, values, and value types. @@ -2969,11 +3546,19 @@ export type Metafield = Node & { namespace: Scalars['String'] /** The parent object that the metafield belongs to. */ parentResource: MetafieldParentResource + /** + * The type name of the metafield. + * See the list of [supported types](https://shopify.dev/apps/metafields/definitions/types). + */ + type: Scalars['String'] /** The date and time when the storefront metafield was updated. */ updatedAt: Scalars['DateTime'] /** The value of a metafield. */ value: Scalars['String'] - /** Represents the metafield value type. */ + /** + * Represents the metafield value type. + * @deprecated `valueType` is deprecated and replaced by `type` in API version 2021-07. + */ valueType: MetafieldValueType } @@ -2996,7 +3581,16 @@ export type MetafieldEdge = { } /** A resource that the metafield belongs to. */ -export type MetafieldParentResource = Product | ProductVariant +export type MetafieldParentResource = + | Article + | Blog + | Collection + | Customer + | Order + | Page + | Product + | ProductVariant + | Shop /** Metafield value types. */ export enum MetafieldValueType { @@ -3006,6 +3600,10 @@ export enum MetafieldValueType { Integer = 'INTEGER', /** A json string metafield. */ JsonString = 'JSON_STRING', + /** A float metafield. */ + Float = 'FLOAT', + /** A boolean metafield. */ + Boolean = 'BOOLEAN', } /** Represents a Shopify hosted 3D model. */ @@ -3045,29 +3643,7 @@ export type MoneyInput = { currencyCode: CurrencyCode } -/** - * A monetary value with currency. - * - * To format currencies, combine this type's amount and currencyCode fields with your client's locale. - * - * For example, in JavaScript you could use Intl.NumberFormat: - * - * ```js - * new Intl.NumberFormat(locale, { - * style: 'currency', - * currency: currencyCode - * }).format(amount); - * ``` - * - * Other formatting libraries include: - * - * * iOS - [NumberFormatter](https://developer.apple.com/documentation/foundation/numberformatter) - * * Android - [NumberFormat](https://developer.android.com/reference/java/text/NumberFormat.html) - * * PHP - [NumberFormatter](http://php.net/manual/en/class.numberformatter.php) - * - * For a more general solution, the [Unicode CLDR number formatting database] is available with many implementations - * (such as [TwitterCldr](https://github.com/twitter/twitter-cldr-rb)). - */ +/** A monetary value with currency. */ export type MoneyV2 = { __typename?: 'MoneyV2' /** Decimal money amount. */ @@ -3097,12 +3673,28 @@ export type MoneyV2Edge = { /** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ export type Mutation = { __typename?: 'Mutation' + /** Updates the attributes on a cart. */ + cartAttributesUpdate?: Maybe + /** Updates customer information associated with a cart. */ + cartBuyerIdentityUpdate?: Maybe + /** Creates a new cart. */ + cartCreate?: Maybe + /** Updates the discount codes applied to the cart. */ + cartDiscountCodesUpdate?: Maybe + /** Adds a merchandise line to the cart. */ + cartLinesAdd?: Maybe + /** Removes one or more merchandise lines from the cart. */ + cartLinesRemove?: Maybe + /** Updates one or more merchandise lines on a cart. */ + cartLinesUpdate?: Maybe + /** Updates the note on the cart. */ + cartNoteUpdate?: Maybe /** - * Updates the attributes of a checkout. + * Updates the attributes of a checkout if `allowPartialAddresses` is `true`. * @deprecated Use `checkoutAttributesUpdateV2` instead */ checkoutAttributesUpdate?: Maybe - /** Updates the attributes of a checkout. */ + /** Updates the attributes of a checkout if `allowPartialAddresses` is `true`. */ checkoutAttributesUpdateV2?: Maybe /** Completes a checkout without providing payment information. You can use this mutation for free items or items whose purchase price is covered by a gift card. */ checkoutCompleteFree?: Maybe @@ -3232,6 +3824,53 @@ export type Mutation = { customerUpdate?: Maybe } +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartAttributesUpdateArgs = { + attributes: Array + cartId: Scalars['ID'] +} + +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartBuyerIdentityUpdateArgs = { + cartId: Scalars['ID'] + buyerIdentity: CartBuyerIdentityInput +} + +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartCreateArgs = { + input?: Maybe +} + +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartDiscountCodesUpdateArgs = { + cartId: Scalars['ID'] + discountCodes?: Maybe> +} + +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartLinesAddArgs = { + lines: Array + cartId: Scalars['ID'] +} + +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartLinesRemoveArgs = { + cartId: Scalars['ID'] + lineIds: Array +} + +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartLinesUpdateArgs = { + cartId: Scalars['ID'] + lines: Array +} + +/** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ +export type MutationCartNoteUpdateArgs = { + cartId: Scalars['ID'] + note?: Maybe +} + /** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ export type MutationCheckoutAttributesUpdateArgs = { checkoutId: Scalars['ID'] @@ -3282,6 +3921,7 @@ export type MutationCheckoutCompleteWithTokenizedPaymentV3Args = { /** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ export type MutationCheckoutCreateArgs = { input: CheckoutCreateInput + queueToken?: Maybe } /** The schema’s entry-point for mutations. This acts as the public, top-level API from which all mutation queries must start. */ @@ -3493,99 +4133,108 @@ export type Node = { } /** An order is a customer’s completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time they provides an email address, billing address and payment information. */ -export type Order = Node & { - __typename?: 'Order' - /** The reason for the order's cancellation. Returns `null` if the order wasn't canceled. */ - cancelReason?: Maybe - /** The date and time when the order was canceled. Returns null if the order wasn't canceled. */ - canceledAt?: Maybe - /** The code of the currency used for the payment. */ - currencyCode: CurrencyCode - /** The subtotal of line items and their discounts, excluding line items that have been removed. Does not contain order-level discounts, duties, shipping costs, or shipping discounts. Taxes are not included unless the order is a taxes-included order. */ - currentSubtotalPrice: MoneyV2 - /** The total amount of the order, including duties, taxes and discounts, minus amounts for line items that have been removed. */ - currentTotalPrice: MoneyV2 - /** The total of all taxes applied to the order, excluding taxes for returned line items. */ - currentTotalTax: MoneyV2 - /** The locale code in which this specific order happened. */ - customerLocale?: Maybe - /** The unique URL that the customer can use to access the order. */ - customerUrl?: Maybe - /** Discounts that have been applied on the order. */ - discountApplications: DiscountApplicationConnection - /** Whether the order has had any edits applied or not. */ - edited: Scalars['Boolean'] - /** The customer's email address. */ - email?: Maybe - /** The financial status of the order. */ - financialStatus?: Maybe - /** The fulfillment status for the order. */ - fulfillmentStatus: OrderFulfillmentStatus - /** Globally unique identifier. */ - id: Scalars['ID'] - /** List of the order’s line items. */ - lineItems: OrderLineItemConnection - /** - * Unique identifier for the order that appears on the order. - * For example, _#1000_ or _Store1001. - */ - name: Scalars['String'] - /** A unique numeric identifier for the order for use by shop owner and customer. */ - orderNumber: Scalars['Int'] - /** The total price of the order before any applied edits. */ - originalTotalPrice: MoneyV2 - /** The customer's phone number for receiving SMS notifications. */ - phone?: Maybe - /** - * The date and time when the order was imported. - * This value can be set to dates in the past when importing from other systems. - * If no value is provided, it will be auto-generated based on current date and time. - */ - processedAt: Scalars['DateTime'] - /** The address to where the order will be shipped. */ - shippingAddress?: Maybe - /** The discounts that have been allocated onto the shipping line by discount applications. */ - shippingDiscountAllocations: Array - /** The unique URL for the order's status page. */ - statusUrl: Scalars['URL'] - /** - * Price of the order before shipping and taxes. - * @deprecated Use `subtotalPriceV2` instead - */ - subtotalPrice?: Maybe - /** Price of the order before duties, shipping and taxes. */ - subtotalPriceV2?: Maybe - /** List of the order’s successful fulfillments. */ - successfulFulfillments?: Maybe> - /** - * The sum of all the prices of all the items in the order, taxes and discounts included (must be positive). - * @deprecated Use `totalPriceV2` instead - */ - totalPrice: Scalars['Money'] - /** The sum of all the prices of all the items in the order, duties, taxes and discounts included (must be positive). */ - totalPriceV2: MoneyV2 - /** - * The total amount that has been refunded. - * @deprecated Use `totalRefundedV2` instead - */ - totalRefunded: Scalars['Money'] - /** The total amount that has been refunded. */ - totalRefundedV2: MoneyV2 - /** - * The total cost of shipping. - * @deprecated Use `totalShippingPriceV2` instead - */ - totalShippingPrice: Scalars['Money'] - /** The total cost of shipping. */ - totalShippingPriceV2: MoneyV2 - /** - * The total cost of taxes. - * @deprecated Use `totalTaxV2` instead - */ - totalTax?: Maybe - /** The total cost of taxes. */ - totalTaxV2?: Maybe -} +export type Order = Node & + HasMetafields & { + __typename?: 'Order' + /** The reason for the order's cancellation. Returns `null` if the order wasn't canceled. */ + cancelReason?: Maybe + /** The date and time when the order was canceled. Returns null if the order wasn't canceled. */ + canceledAt?: Maybe + /** The code of the currency used for the payment. */ + currencyCode: CurrencyCode + /** The subtotal of line items and their discounts, excluding line items that have been removed. Does not contain order-level discounts, duties, shipping costs, or shipping discounts. Taxes are not included unless the order is a taxes-included order. */ + currentSubtotalPrice: MoneyV2 + /** The total cost of duties for the order, including refunds. */ + currentTotalDuties?: Maybe + /** The total amount of the order, including duties, taxes and discounts, minus amounts for line items that have been removed. */ + currentTotalPrice: MoneyV2 + /** The total of all taxes applied to the order, excluding taxes for returned line items. */ + currentTotalTax: MoneyV2 + /** The locale code in which this specific order happened. */ + customerLocale?: Maybe + /** The unique URL that the customer can use to access the order. */ + customerUrl?: Maybe + /** Discounts that have been applied on the order. */ + discountApplications: DiscountApplicationConnection + /** Whether the order has had any edits applied or not. */ + edited: Scalars['Boolean'] + /** The customer's email address. */ + email?: Maybe + /** The financial status of the order. */ + financialStatus?: Maybe + /** The fulfillment status for the order. */ + fulfillmentStatus: OrderFulfillmentStatus + /** Globally unique identifier. */ + id: Scalars['ID'] + /** List of the order’s line items. */ + lineItems: OrderLineItemConnection + /** Returns a metafield found by namespace and key. */ + metafield?: Maybe + /** A paginated list of metafields associated with the resource. */ + metafields: MetafieldConnection + /** + * Unique identifier for the order that appears on the order. + * For example, _#1000_ or _Store1001. + */ + name: Scalars['String'] + /** A unique numeric identifier for the order for use by shop owner and customer. */ + orderNumber: Scalars['Int'] + /** The total cost of duties charged at checkout. */ + originalTotalDuties?: Maybe + /** The total price of the order before any applied edits. */ + originalTotalPrice: MoneyV2 + /** The customer's phone number for receiving SMS notifications. */ + phone?: Maybe + /** + * The date and time when the order was imported. + * This value can be set to dates in the past when importing from other systems. + * If no value is provided, it will be auto-generated based on current date and time. + */ + processedAt: Scalars['DateTime'] + /** The address to where the order will be shipped. */ + shippingAddress?: Maybe + /** The discounts that have been allocated onto the shipping line by discount applications. */ + shippingDiscountAllocations: Array + /** The unique URL for the order's status page. */ + statusUrl: Scalars['URL'] + /** + * Price of the order before shipping and taxes. + * @deprecated Use `subtotalPriceV2` instead + */ + subtotalPrice?: Maybe + /** Price of the order before duties, shipping and taxes. */ + subtotalPriceV2?: Maybe + /** List of the order’s successful fulfillments. */ + successfulFulfillments?: Maybe> + /** + * The sum of all the prices of all the items in the order, taxes and discounts included (must be positive). + * @deprecated Use `totalPriceV2` instead + */ + totalPrice: Scalars['Money'] + /** The sum of all the prices of all the items in the order, duties, taxes and discounts included (must be positive). */ + totalPriceV2: MoneyV2 + /** + * The total amount that has been refunded. + * @deprecated Use `totalRefundedV2` instead + */ + totalRefunded: Scalars['Money'] + /** The total amount that has been refunded. */ + totalRefundedV2: MoneyV2 + /** + * The total cost of shipping. + * @deprecated Use `totalShippingPriceV2` instead + */ + totalShippingPrice: Scalars['Money'] + /** The total cost of shipping. */ + totalShippingPriceV2: MoneyV2 + /** + * The total cost of taxes. + * @deprecated Use `totalTaxV2` instead + */ + totalTax?: Maybe + /** The total cost of taxes. */ + totalTaxV2?: Maybe + } /** An order is a customer’s completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time they provides an email address, billing address and payment information. */ export type OrderDiscountApplicationsArgs = { @@ -3605,6 +4254,22 @@ export type OrderLineItemsArgs = { reverse?: Maybe } +/** An order is a customer’s completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time they provides an email address, billing address and payment information. */ +export type OrderMetafieldArgs = { + namespace: Scalars['String'] + key: Scalars['String'] +} + +/** An order is a customer’s completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time they provides an email address, billing address and payment information. */ +export type OrderMetafieldsArgs = { + namespace?: Maybe + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** An order is a customer’s completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time they provides an email address, billing address and payment information. */ export type OrderSuccessfulFulfillmentsArgs = { first?: Maybe @@ -3658,6 +4323,8 @@ export enum OrderFinancialStatus { Paid = 'PAID', /** Displayed as **Refunded**. */ Refunded = 'REFUNDED', + /** Displayed as **Expired**. */ + Expired = 'EXPIRED', } /** Represents the order's current fulfillment status. */ @@ -3676,6 +4343,8 @@ export enum OrderFulfillmentStatus { Open = 'OPEN', /** Displayed as **In progress**. */ InProgress = 'IN_PROGRESS', + /** Displayed as **On hold**. */ + OnHold = 'ON_HOLD', /** Displayed as **Scheduled**. */ Scheduled = 'SCHEDULED', } @@ -3736,26 +4405,47 @@ export enum OrderSortKeys { } /** Shopify merchants can create pages to hold static HTML content. Each Page object represents a custom page on the online store. */ -export type Page = Node & { - __typename?: 'Page' - /** The description of the page, complete with HTML formatting. */ - body: Scalars['HTML'] - /** Summary of the page body. */ - bodySummary: Scalars['String'] - /** The timestamp of the page creation. */ - createdAt: Scalars['DateTime'] - /** A human-friendly unique string for the page automatically generated from its title. */ - handle: Scalars['String'] - /** Globally unique identifier. */ - id: Scalars['ID'] - /** The page's SEO information. */ - seo?: Maybe - /** The title of the page. */ - title: Scalars['String'] - /** The timestamp of the latest page update. */ - updatedAt: Scalars['DateTime'] - /** The url pointing to the page accessible from the web. */ - url: Scalars['URL'] +export type Page = Node & + HasMetafields & { + __typename?: 'Page' + /** The description of the page, complete with HTML formatting. */ + body: Scalars['HTML'] + /** Summary of the page body. */ + bodySummary: Scalars['String'] + /** The timestamp of the page creation. */ + createdAt: Scalars['DateTime'] + /** A human-friendly unique string for the page automatically generated from its title. */ + handle: Scalars['String'] + /** Globally unique identifier. */ + id: Scalars['ID'] + /** Returns a metafield found by namespace and key. */ + metafield?: Maybe + /** A paginated list of metafields associated with the resource. */ + metafields: MetafieldConnection + /** The page's SEO information. */ + seo?: Maybe + /** The title of the page. */ + title: Scalars['String'] + /** The timestamp of the latest page update. */ + updatedAt: Scalars['DateTime'] + /** The url pointing to the page accessible from the web. */ + url: Scalars['URL'] + } + +/** Shopify merchants can create pages to hold static HTML content. Each Page object represents a custom page on the online store. */ +export type PageMetafieldArgs = { + namespace: Scalars['String'] + key: Scalars['String'] +} + +/** Shopify merchants can create pages to hold static HTML content. Each Page object represents a custom page on the online store. */ +export type PageMetafieldsArgs = { + namespace?: Maybe + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe } /** An auto-generated type for paginating through multiple Pages. */ @@ -3866,6 +4556,16 @@ export enum PaymentTokenType { ShopifyPay = 'SHOPIFY_PAY', /** Google Pay token type. */ GooglePay = 'GOOGLE_PAY', + /** Stripe token type. */ + StripeVaultToken = 'STRIPE_VAULT_TOKEN', +} + +/** A filter used to view a subset of products in a collection matching a specific price range. */ +export type PriceRangeFilter = { + /** The minimum price in the range. Defaults to zero. */ + min?: Maybe + /** The maximum price in the range. Empty indicates no max price. */ + max?: Maybe } /** The value of the percentage pricing object. */ @@ -3908,7 +4608,7 @@ export type Product = Node & images: ImageConnection /** The media associated with the product. */ media: MediaConnection - /** The metafield associated with the resource. */ + /** Returns a metafield found by namespace and key. */ metafield?: Maybe /** A paginated list of metafields associated with the resource. */ metafields: MetafieldConnection @@ -3919,7 +4619,10 @@ export type Product = Node & onlineStoreUrl?: Maybe /** List of product options. */ options: Array - /** List of price ranges in the presentment currencies for this shop. */ + /** + * List of price ranges in the presentment currencies for this shop. + * @deprecated Use `@inContext` instead. + */ presentmentPriceRanges: ProductPriceRangeConnection /** The price range. */ priceRange: ProductPriceRange @@ -3927,6 +4630,10 @@ export type Product = Node & productType: Scalars['String'] /** The date and time when the product was published to the channel. */ publishedAt: Scalars['DateTime'] + /** Whether the product can only be purchased with a selling plan. */ + requiresSellingPlan: Scalars['Boolean'] + /** A list of a product's available selling plan groups. A selling plan group represents a selling method. For example, 'Subscribe and save' is a selling method where customers pay for goods or services per delivery. A selling plan group contains individual selling plans. */ + sellingPlanGroups: SellingPlanGroupConnection /** The product's SEO information. */ seo: Seo /** @@ -4050,6 +4757,18 @@ export type ProductPresentmentPriceRangesArgs = { reverse?: Maybe } +/** + * A product represents an individual item for sale in a Shopify store. Products are often physical, but they don't have to be. + * For example, a digital download (such as a movie, music or ebook file) also qualifies as a product, as do services (such as equipment rental, work for hire, customization of another product or an extended warranty). + */ +export type ProductSellingPlanGroupsArgs = { + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** * A product represents an individual item for sale in a Shopify store. Products are often physical, but they don't have to be. * For example, a digital download (such as a movie, music or ebook file) also qualifies as a product, as do services (such as equipment rental, work for hire, customization of another product or an extended warranty). @@ -4100,6 +4819,8 @@ export type ProductConnection = { __typename?: 'ProductConnection' /** A list of edges. */ edges: Array + /** A list of available filters. */ + filters: Array /** Information to aid in pagination. */ pageInfo: PageInfo } @@ -4113,6 +4834,20 @@ export type ProductEdge = { node: Product } +/** A filter used to view a subset of products in a collection. */ +export type ProductFilter = { + /** Filter on if the product is in stock. */ + inStock?: Maybe + /** A variant option to filter on. */ + variantOption?: Maybe + /** The product type to filter on. */ + productType?: Maybe + /** The product vendor to filter on. */ + productVendor?: Maybe + /** A range of prices to filter with-in. */ + price?: Maybe +} + /** The set of valid sort keys for the ProductImage query. */ export enum ProductImageSortKeys { /** Sort by the `created_at` value. */ @@ -4235,13 +4970,19 @@ export type ProductVariant = Node & id: Scalars['ID'] /** Image associated with the product variant. This field falls back to the product image if no image is available. */ image?: Maybe - /** The metafield associated with the resource. */ + /** Returns a metafield found by namespace and key. */ metafield?: Maybe /** A paginated list of metafields associated with the resource. */ metafields: MetafieldConnection - /** List of prices and compare-at prices in the presentment currencies for this shop. */ + /** + * List of prices and compare-at prices in the presentment currencies for this shop. + * @deprecated Use `@inContext` instead. + */ presentmentPrices: ProductVariantPricePairConnection - /** List of unit prices in the presentment currencies for this shop. */ + /** + * List of unit prices in the presentment currencies for this shop. + * @deprecated Use `@inContext` instead. + */ presentmentUnitPrices: MoneyV2Connection /** * The product variant’s price. @@ -4258,8 +4999,12 @@ export type ProductVariant = Node & requiresShipping: Scalars['Boolean'] /** List of product options applied to the variant. */ selectedOptions: Array + /** Represents an association between a variant and a selling plan. Selling plan allocations describe which selling plans are available for each variant, and what their impact is on pricing. */ + sellingPlanAllocations: SellingPlanAllocationConnection /** The SKU (stock keeping unit) associated with the variant. */ sku?: Maybe + /** The in-store pickup availability of this variant by location. */ + storeAvailability: StoreAvailabilityConnection /** The product variant’s title. */ title: Scalars['String'] /** The unit price value for the variant based on the variant's measurement. */ @@ -4316,6 +5061,24 @@ export type ProductVariantPresentmentUnitPricesArgs = { reverse?: Maybe } +/** A product variant represents a different version of a product, such as differing sizes or differing colors. */ +export type ProductVariantSellingPlanAllocationsArgs = { + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + +/** A product variant represents a different version of a product, such as differing sizes or differing colors. */ +export type ProductVariantStoreAvailabilityArgs = { + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** An auto-generated type for paginating through multiple ProductVariants. */ export type ProductVariantConnection = { __typename?: 'ProductVariantConnection' @@ -4388,12 +5151,22 @@ export type QueryRoot = { blogByHandle?: Maybe /** List of the shop's blogs. */ blogs: BlogConnection + /** Find a cart by its ID. */ + cart?: Maybe /** Find a collection by its handle. */ collectionByHandle?: Maybe /** List of the shop’s collections. */ collections: CollectionConnection /** Find a customer by its access token. */ customer?: Maybe + /** Returns the localized experiences configured for the shop. */ + localization: Localization + /** + * List of the shop's locations that support in-store pickup. + * + * When sorting by distance, you must specify a location via the `near` argument. + */ + locations: LocationConnection /** Returns a specific node by ID. */ node?: Maybe /** Returns the list of nodes with the given IDs. */ @@ -4452,6 +5225,11 @@ export type QueryRootBlogsArgs = { query?: Maybe } +/** The schema’s entry-point for queries. This acts as the public, top-level API from which all queries must start. */ +export type QueryRootCartArgs = { + id: Scalars['ID'] +} + /** The schema’s entry-point for queries. This acts as the public, top-level API from which all queries must start. */ export type QueryRootCollectionByHandleArgs = { handle: Scalars['String'] @@ -4473,6 +5251,17 @@ export type QueryRootCustomerArgs = { customerAccessToken: Scalars['String'] } +/** The schema’s entry-point for queries. This acts as the public, top-level API from which all queries must start. */ +export type QueryRootLocationsArgs = { + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe + sortKey?: Maybe + near?: Maybe +} + /** The schema’s entry-point for queries. This acts as the public, top-level API from which all queries must start. */ export type QueryRootNodeArgs = { id: Scalars['ID'] @@ -4582,6 +5371,175 @@ export type SelectedOptionInput = { value: Scalars['String'] } +/** Represents how products and variants can be sold and purchased. */ +export type SellingPlan = { + __typename?: 'SellingPlan' + /** The description of the selling plan. */ + description?: Maybe + /** A globally unique identifier. */ + id: Scalars['ID'] + /** The name of the selling plan. For example, '6 weeks of prepaid granola, delivered weekly'. */ + name: Scalars['String'] + /** Represents the selling plan options available in the drop-down list in the storefront. For example, 'Delivery every week' or 'Delivery every 2 weeks' specifies the delivery frequency options for the product. */ + options: Array + /** Represents how a selling plan affects pricing when a variant is purchased with a selling plan. */ + priceAdjustments: Array + /** Whether purchasing the selling plan will result in multiple deliveries. */ + recurringDeliveries: Scalars['Boolean'] +} + +/** Represents an association between a variant and a selling plan. Selling plan allocations describe the options offered for each variant, and the price of the variant when purchased with a selling plan. */ +export type SellingPlanAllocation = { + __typename?: 'SellingPlanAllocation' + /** A list of price adjustments, with a maximum of two. When there are two, the first price adjustment goes into effect at the time of purchase, while the second one starts after a certain number of orders. */ + priceAdjustments: Array + /** A representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'. */ + sellingPlan: SellingPlan +} + +/** An auto-generated type for paginating through multiple SellingPlanAllocations. */ +export type SellingPlanAllocationConnection = { + __typename?: 'SellingPlanAllocationConnection' + /** A list of edges. */ + edges: Array + /** Information to aid in pagination. */ + pageInfo: PageInfo +} + +/** An auto-generated type which holds one SellingPlanAllocation and a cursor during pagination. */ +export type SellingPlanAllocationEdge = { + __typename?: 'SellingPlanAllocationEdge' + /** A cursor for use in pagination. */ + cursor: Scalars['String'] + /** The item at the end of SellingPlanAllocationEdge. */ + node: SellingPlanAllocation +} + +/** The resulting prices for variants when they're purchased with a specific selling plan. */ +export type SellingPlanAllocationPriceAdjustment = { + __typename?: 'SellingPlanAllocationPriceAdjustment' + /** The price of the variant when it's purchased without a selling plan for the same number of deliveries. For example, if a customer purchases 6 deliveries of $10.00 granola separately, then the price is 6 x $10.00 = $60.00. */ + compareAtPrice: MoneyV2 + /** The effective price for a single delivery. For example, for a prepaid subscription plan that includes 6 deliveries at the price of $48.00, the per delivery price is $8.00. */ + perDeliveryPrice: MoneyV2 + /** The price of the variant when it's purchased with a selling plan For example, for a prepaid subscription plan that includes 6 deliveries of $10.00 granola, where the customer gets 20% off, the price is 6 x $10.00 x 0.80 = $48.00. */ + price: MoneyV2 + /** The resulting price per unit for the variant associated with the selling plan. If the variant isn't sold by quantity or measurement, then this field returns `null`. */ + unitPrice?: Maybe +} + +/** An auto-generated type for paginating through multiple SellingPlans. */ +export type SellingPlanConnection = { + __typename?: 'SellingPlanConnection' + /** A list of edges. */ + edges: Array + /** Information to aid in pagination. */ + pageInfo: PageInfo +} + +/** An auto-generated type which holds one SellingPlan and a cursor during pagination. */ +export type SellingPlanEdge = { + __typename?: 'SellingPlanEdge' + /** A cursor for use in pagination. */ + cursor: Scalars['String'] + /** The item at the end of SellingPlanEdge. */ + node: SellingPlan +} + +/** A fixed amount that's deducted from the original variant price. For example, $10.00 off. */ +export type SellingPlanFixedAmountPriceAdjustment = { + __typename?: 'SellingPlanFixedAmountPriceAdjustment' + /** The money value of the price adjustment. */ + adjustmentAmount: MoneyV2 +} + +/** A fixed price adjustment for a variant that's purchased with a selling plan. */ +export type SellingPlanFixedPriceAdjustment = { + __typename?: 'SellingPlanFixedPriceAdjustment' + /** A new price of the variant when it's purchased with the selling plan. */ + price: MoneyV2 +} + +/** Represents a selling method. For example, 'Subscribe and save' is a selling method where customers pay for goods or services per delivery. A selling plan group contains individual selling plans. */ +export type SellingPlanGroup = { + __typename?: 'SellingPlanGroup' + /** A display friendly name for the app that created the selling plan group. */ + appName?: Maybe + /** The name of the selling plan group. */ + name: Scalars['String'] + /** Represents the selling plan options available in the drop-down list in the storefront. For example, 'Delivery every week' or 'Delivery every 2 weeks' specifies the delivery frequency options for the product. */ + options: Array + /** A list of selling plans in a selling plan group. A selling plan is a representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'. */ + sellingPlans: SellingPlanConnection +} + +/** Represents a selling method. For example, 'Subscribe and save' is a selling method where customers pay for goods or services per delivery. A selling plan group contains individual selling plans. */ +export type SellingPlanGroupSellingPlansArgs = { + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + +/** An auto-generated type for paginating through multiple SellingPlanGroups. */ +export type SellingPlanGroupConnection = { + __typename?: 'SellingPlanGroupConnection' + /** A list of edges. */ + edges: Array + /** Information to aid in pagination. */ + pageInfo: PageInfo +} + +/** An auto-generated type which holds one SellingPlanGroup and a cursor during pagination. */ +export type SellingPlanGroupEdge = { + __typename?: 'SellingPlanGroupEdge' + /** A cursor for use in pagination. */ + cursor: Scalars['String'] + /** The item at the end of SellingPlanGroupEdge. */ + node: SellingPlanGroup +} + +/** Represents an option on a selling plan group that's available in the drop-down list in the storefront. */ +export type SellingPlanGroupOption = { + __typename?: 'SellingPlanGroupOption' + /** The name of the option. For example, 'Delivery every'. */ + name: Scalars['String'] + /** The values for the options specified by the selling plans in the selling plan group. For example, '1 week', '2 weeks', '3 weeks'. */ + values: Array +} + +/** An option provided by a Selling Plan. */ +export type SellingPlanOption = { + __typename?: 'SellingPlanOption' + /** The name of the option (ie "Delivery every"). */ + name?: Maybe + /** The value of the option (ie "Month"). */ + value?: Maybe +} + +/** A percentage amount that's deducted from the original variant price. For example, 10% off. */ +export type SellingPlanPercentagePriceAdjustment = { + __typename?: 'SellingPlanPercentagePriceAdjustment' + /** The percentage value of the price adjustment. */ + adjustmentPercentage: Scalars['Int'] +} + +/** Represents by how much the price of a variant associated with a selling plan is adjusted. Each variant can have up to two price adjustments. */ +export type SellingPlanPriceAdjustment = { + __typename?: 'SellingPlanPriceAdjustment' + /** The type of price adjustment. An adjustment value can have one of three types: percentage, amount off, or a new price. */ + adjustmentValue: SellingPlanPriceAdjustmentValue + /** The number of orders that the price adjustment applies to If the price adjustment always applies, then this field is `null`. */ + orderCount?: Maybe +} + +/** Represents by how much the price of a variant associated with a selling plan is adjusted. Each variant can have up to two price adjustments. */ +export type SellingPlanPriceAdjustmentValue = + | SellingPlanFixedAmountPriceAdjustment + | SellingPlanFixedPriceAdjustment + | SellingPlanPercentagePriceAdjustment + /** A shipping rate to be applied to a checkout. */ export type ShippingRate = { __typename?: 'ShippingRate' @@ -4599,7 +5557,7 @@ export type ShippingRate = { } /** Shop represents a collection of the general settings and information about the shop. */ -export type Shop = { +export type Shop = HasMetafields & { __typename?: 'Shop' /** * List of the shop' articles. @@ -4628,6 +5586,10 @@ export type Shop = { currencyCode: CurrencyCode /** A description of the shop. */ description?: Maybe + /** Returns a metafield found by namespace and key. */ + metafield?: Maybe + /** A paginated list of metafields associated with the resource. */ + metafields: MetafieldConnection /** A string representing the way currency is formatted when the currency isn’t specified. */ moneyFormat: Scalars['String'] /** The shop’s name. */ @@ -4712,6 +5674,22 @@ export type ShopCollectionsArgs = { query?: Maybe } +/** Shop represents a collection of the general settings and information about the shop. */ +export type ShopMetafieldArgs = { + namespace: Scalars['String'] + key: Scalars['String'] +} + +/** Shop represents a collection of the general settings and information about the shop. */ +export type ShopMetafieldsArgs = { + namespace?: Maybe + first?: Maybe + after?: Maybe + last?: Maybe + before?: Maybe + reverse?: Maybe +} + /** Shop represents a collection of the general settings and information about the shop. */ export type ShopProductByHandleArgs = { handle: Scalars['String'] @@ -4753,6 +5731,35 @@ export type ShopPolicy = Node & { url: Scalars['URL'] } +/** Describes the availability of a product variant at a particular location. */ +export type StoreAvailability = { + __typename?: 'StoreAvailability' + /** Whether or not this product variant is in-stock at this location. */ + available: Scalars['Boolean'] + /** The location where this product variant is stocked at. */ + location: Location + /** Returns the estimated amount of time it takes for pickup to be ready (Example: Usually ready in 24 hours). */ + pickUpTime: Scalars['String'] +} + +/** An auto-generated type for paginating through multiple StoreAvailabilities. */ +export type StoreAvailabilityConnection = { + __typename?: 'StoreAvailabilityConnection' + /** A list of edges. */ + edges: Array + /** Information to aid in pagination. */ + pageInfo: PageInfo +} + +/** An auto-generated type which holds one StoreAvailability and a cursor during pagination. */ +export type StoreAvailabilityEdge = { + __typename?: 'StoreAvailabilityEdge' + /** A cursor for use in pagination. */ + cursor: Scalars['String'] + /** The item at the end of StoreAvailabilityEdge. */ + node: StoreAvailability +} + /** An auto-generated type for paginating through multiple Strings. */ export type StringConnection = { __typename?: 'StringConnection' @@ -4939,15 +5946,31 @@ export enum UnitPriceMeasurementMeasuredUnit { M2 = 'M2', } +/** Systems of weights and measures. */ +export enum UnitSystem { + /** Imperial system of weights and measures. */ + ImperialSystem = 'IMPERIAL_SYSTEM', + /** Metric system of weights and measures. */ + MetricSystem = 'METRIC_SYSTEM', +} + /** Represents an error in the input of a mutation. */ export type UserError = DisplayableError & { __typename?: 'UserError' - /** Path to the input field which caused the error. */ + /** The path to the input field that caused the error. */ field?: Maybe> /** The error message. */ message: Scalars['String'] } +/** A filter used to view a subset of products in a collection matching a specific variant option. */ +export type VariantOptionFilter = { + /** The name of the variant option to filter on. */ + name: Scalars['String'] + /** The value of the variant option to filter on. */ + value: Scalars['String'] +} + /** Represents a Shopify hosted video. */ export type Video = Node & Media & { @@ -5013,77 +6036,75 @@ export type AssociateCustomerWithCheckoutMutation = { > } -export type CheckoutCreateMutationVariables = Exact<{ - input?: Maybe -}> +export type CartCreateMutationVariables = Exact<{ [key: string]: never }> -export type CheckoutCreateMutation = { __typename?: 'Mutation' } & { - checkoutCreate?: Maybe< - { __typename?: 'CheckoutCreatePayload' } & { - checkoutUserErrors: Array< - { __typename?: 'CheckoutUserError' } & Pick< - CheckoutUserError, +export type CartCreateMutation = { __typename?: 'Mutation' } & { + cartCreate?: Maybe< + { __typename?: 'CartCreatePayload' } & { + cart?: Maybe<{ __typename?: 'Cart' } & CartDetailsFragment> + userErrors: Array< + { __typename?: 'CartUserError' } & Pick< + CartUserError, 'code' | 'field' | 'message' > > - checkout?: Maybe<{ __typename?: 'Checkout' } & CheckoutDetailsFragment> } > } -export type CheckoutLineItemAddMutationVariables = Exact<{ - checkoutId: Scalars['ID'] - lineItems: Array | CheckoutLineItemInput +export type CartLinesAddMutationVariables = Exact<{ + lines: Array | CartLineInput + cartId: Scalars['ID'] }> -export type CheckoutLineItemAddMutation = { __typename?: 'Mutation' } & { - checkoutLineItemsAdd?: Maybe< - { __typename?: 'CheckoutLineItemsAddPayload' } & { - checkoutUserErrors: Array< - { __typename?: 'CheckoutUserError' } & Pick< - CheckoutUserError, +export type CartLinesAddMutation = { __typename?: 'Mutation' } & { + cartLinesAdd?: Maybe< + { __typename?: 'CartLinesAddPayload' } & { + cart?: Maybe<{ __typename?: 'Cart' } & CartDetailsFragment> + userErrors: Array< + { __typename?: 'CartUserError' } & Pick< + CartUserError, 'code' | 'field' | 'message' > > - checkout?: Maybe<{ __typename?: 'Checkout' } & CheckoutDetailsFragment> } > } -export type CheckoutLineItemRemoveMutationVariables = Exact<{ - checkoutId: Scalars['ID'] - lineItemIds: Array | Scalars['ID'] +export type CartLinesRemoveMutationVariables = Exact<{ + cartId: Scalars['ID'] + lineIds: Array | Scalars['ID'] }> -export type CheckoutLineItemRemoveMutation = { __typename?: 'Mutation' } & { - checkoutLineItemsRemove?: Maybe< - { __typename?: 'CheckoutLineItemsRemovePayload' } & { - checkoutUserErrors: Array< - { __typename?: 'CheckoutUserError' } & Pick< - CheckoutUserError, +export type CartLinesRemoveMutation = { __typename?: 'Mutation' } & { + cartLinesRemove?: Maybe< + { __typename?: 'CartLinesRemovePayload' } & { + cart?: Maybe<{ __typename?: 'Cart' } & CartDetailsFragment> + userErrors: Array< + { __typename?: 'CartUserError' } & Pick< + CartUserError, 'code' | 'field' | 'message' > > - checkout?: Maybe<{ __typename?: 'Checkout' } & CheckoutDetailsFragment> } > } -export type CheckoutLineItemUpdateMutationVariables = Exact<{ - checkoutId: Scalars['ID'] - lineItems: Array | CheckoutLineItemUpdateInput +export type CartLinesUpdateMutationVariables = Exact<{ + cartId: Scalars['ID'] + lines: Array | CartLineUpdateInput }> -export type CheckoutLineItemUpdateMutation = { __typename?: 'Mutation' } & { - checkoutLineItemsUpdate?: Maybe< - { __typename?: 'CheckoutLineItemsUpdatePayload' } & { - checkoutUserErrors: Array< - { __typename?: 'CheckoutUserError' } & Pick< - CheckoutUserError, +export type CartLinesUpdateMutation = { __typename?: 'Mutation' } & { + cartLinesUpdate?: Maybe< + { __typename?: 'CartLinesUpdatePayload' } & { + cart?: Maybe<{ __typename?: 'Cart' } & CartDetailsFragment> + userErrors: Array< + { __typename?: 'CartUserError' } & Pick< + CartUserError, 'code' | 'field' | 'message' > > - checkout?: Maybe<{ __typename?: 'Checkout' } & CheckoutDetailsFragment> } > } @@ -5312,80 +6333,64 @@ export type GetAllProductsQuery = { __typename?: 'QueryRoot' } & { products: { __typename?: 'ProductConnection' } & ProductConnectionFragment } -export type CheckoutDetailsFragment = { __typename?: 'Checkout' } & Pick< - Checkout, - 'id' | 'webUrl' | 'completedAt' | 'createdAt' | 'taxesIncluded' +export type CartDetailsFragment = { __typename?: 'Cart' } & Pick< + Cart, + 'id' | 'createdAt' | 'updatedAt' > & { - subtotalPriceV2: { __typename?: 'MoneyV2' } & Pick< - MoneyV2, - 'amount' | 'currencyCode' - > - totalTaxV2: { __typename?: 'MoneyV2' } & Pick< - MoneyV2, - 'amount' | 'currencyCode' - > - totalPriceV2: { __typename?: 'MoneyV2' } & Pick< - MoneyV2, - 'amount' | 'currencyCode' - > - lineItems: { __typename?: 'CheckoutLineItemConnection' } & { - pageInfo: { __typename?: 'PageInfo' } & Pick< - PageInfo, - 'hasNextPage' | 'hasPreviousPage' - > + lines: { __typename?: 'CartLineConnection' } & { edges: Array< - { __typename?: 'CheckoutLineItemEdge' } & { - node: { __typename?: 'CheckoutLineItem' } & Pick< - CheckoutLineItem, - 'id' | 'title' | 'quantity' - > & { - variant?: Maybe< - { __typename?: 'ProductVariant' } & Pick< - ProductVariant, - 'id' | 'sku' | 'title' - > & { - image?: Maybe< - { __typename?: 'Image' } & Pick< - Image, - 'originalSrc' | 'altText' | 'width' | 'height' - > - > - priceV2: { __typename?: 'MoneyV2' } & Pick< - MoneyV2, - 'amount' | 'currencyCode' - > - compareAtPriceV2?: Maybe< - { __typename?: 'MoneyV2' } & Pick< - MoneyV2, - 'amount' | 'currencyCode' - > - > - product: { __typename?: 'Product' } & Pick< - Product, - 'handle' - > - } + { __typename?: 'CartLineEdge' } & { + node: { __typename?: 'CartLine' } & Pick & { + merchandise: { __typename?: 'ProductVariant' } & Pick< + ProductVariant, + 'id' > } } > } + attributes: Array< + { __typename?: 'Attribute' } & Pick + > + buyerIdentity: { __typename?: 'CartBuyerIdentity' } & Pick< + CartBuyerIdentity, + 'email' + > & { customer?: Maybe<{ __typename?: 'Customer' } & Pick> } + estimatedCost: { __typename?: 'CartEstimatedCost' } & { + totalAmount: { __typename?: 'MoneyV2' } & Pick< + MoneyV2, + 'amount' | 'currencyCode' + > + subtotalAmount: { __typename?: 'MoneyV2' } & Pick< + MoneyV2, + 'amount' | 'currencyCode' + > + totalTaxAmount?: Maybe< + { __typename?: 'MoneyV2' } & Pick + > + totalDutyAmount?: Maybe< + { __typename?: 'MoneyV2' } & Pick + > + } } -export type GetCheckoutQueryVariables = Exact<{ - checkoutId: Scalars['ID'] +export type GetCartQueryVariables = Exact<{ + cartId: Scalars['ID'] }> -export type GetCheckoutQuery = { __typename?: 'QueryRoot' } & { +export type GetCartQuery = { __typename?: 'QueryRoot' } & { node?: Maybe< | { __typename?: 'AppliedGiftCard' } | { __typename?: 'Article' } | { __typename?: 'Blog' } - | ({ __typename?: 'Checkout' } & CheckoutDetailsFragment) + | ({ __typename?: 'Cart' } & CartDetailsFragment) + | { __typename?: 'CartLine' } + | { __typename?: 'Checkout' } | { __typename?: 'CheckoutLineItem' } | { __typename?: 'Collection' } | { __typename?: 'Comment' } | { __typename?: 'ExternalVideo' } + | { __typename?: 'Location' } | { __typename?: 'MailingAddress' } | { __typename?: 'MediaImage' } | { __typename?: 'Metafield' } @@ -5413,6 +6418,8 @@ export type GetProductsFromCollectionQuery = { __typename?: 'QueryRoot' } & { | ({ __typename?: 'AppliedGiftCard' } & Pick) | ({ __typename?: 'Article' } & Pick) | ({ __typename?: 'Blog' } & Pick) + | ({ __typename?: 'Cart' } & Pick) + | ({ __typename?: 'CartLine' } & Pick) | ({ __typename?: 'Checkout' } & Pick) | ({ __typename?: 'CheckoutLineItem' } & Pick) | ({ __typename?: 'Collection' } & Pick & { @@ -5422,6 +6429,7 @@ export type GetProductsFromCollectionQuery = { __typename?: 'QueryRoot' } & { }) | ({ __typename?: 'Comment' } & Pick) | ({ __typename?: 'ExternalVideo' } & Pick) + | ({ __typename?: 'Location' } & Pick) | ({ __typename?: 'MailingAddress' } & Pick) | ({ __typename?: 'MediaImage' } & Pick) | ({ __typename?: 'Metafield' } & Pick) @@ -5475,11 +6483,14 @@ export type GetPageQuery = { __typename?: 'QueryRoot' } & { | ({ __typename?: 'AppliedGiftCard' } & Pick) | ({ __typename?: 'Article' } & Pick) | ({ __typename?: 'Blog' } & Pick) + | ({ __typename?: 'Cart' } & Pick) + | ({ __typename?: 'CartLine' } & Pick) | ({ __typename?: 'Checkout' } & Pick) | ({ __typename?: 'CheckoutLineItem' } & Pick) | ({ __typename?: 'Collection' } & Pick) | ({ __typename?: 'Comment' } & Pick) | ({ __typename?: 'ExternalVideo' } & Pick) + | ({ __typename?: 'Location' } & Pick) | ({ __typename?: 'MailingAddress' } & Pick) | ({ __typename?: 'MediaImage' } & Pick) | ({ __typename?: 'Metafield' } & Pick) @@ -5508,6 +6519,7 @@ export type GetProductBySlugQuery = { __typename?: 'QueryRoot' } & { Product, | 'id' | 'handle' + | 'availableForSale' | 'title' | 'productType' | 'vendor' @@ -5539,7 +6551,7 @@ export type GetProductBySlugQuery = { __typename?: 'QueryRoot' } & { { __typename?: 'ProductVariantEdge' } & { node: { __typename?: 'ProductVariant' } & Pick< ProductVariant, - 'id' | 'title' | 'sku' + 'id' | 'title' | 'sku' | 'availableForSale' | 'requiresShipping' > & { selectedOptions: Array< { __typename?: 'SelectedOption' } & Pick< diff --git a/framework/shopify/schema.graphql b/framework/shopify/schema.graphql index 9c657fe43..811779674 100644 --- a/framework/shopify/schema.graphql +++ b/framework/shopify/schema.graphql @@ -14,13 +14,18 @@ directive @accessRestricted( ) on FIELD_DEFINITION | OBJECT """ -Contextualize data. +Contextualizes data based on the additional information provided by the directive. For example, you can use the `@inContext(country: CA)` directive to query the price of a product in a storefront within the context of Canada. """ directive @inContext( """ - The country code for context. + The country code for context. For example, `CA`. """ - country: CountryCode! + country: CountryCode + + """ + The identifier of the customer's preferred location. + """ + preferredLocationId: ID ) on QUERY | MUTATION """ @@ -86,7 +91,7 @@ type AppliedGiftCard implements Node { """ An article in an online store blog. """ -type Article implements Node { +type Article implements Node & HasMetafields { """ The article's author. """ @@ -197,6 +202,56 @@ type Article implements Node { scale: Int = 1 ): Image + """ + Returns a metafield found by namespace and key. + """ + metafield( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String! + + """ + Identifier for the metafield (maximum of 30 characters). + """ + key: String! + ): Metafield + + """ + A paginated list of metafields associated with the resource. + """ + metafields( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String + + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): MetafieldConnection! + """ The date and time when the article was published. """ @@ -405,7 +460,7 @@ type AvailableShippingRates { """ An online store blog. """ -type Blog implements Node { +type Blog implements Node & HasMetafields { """ Find an article by its handle. """ @@ -479,6 +534,56 @@ type Blog implements Node { """ id: ID! + """ + Returns a metafield found by namespace and key. + """ + metafield( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String! + + """ + Identifier for the metafield (maximum of 30 characters). + """ + key: String! + ): Metafield + + """ + A paginated list of metafields associated with the resource. + """ + metafields( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String + + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): MetafieldConnection! + """ The blog's SEO information. """ @@ -585,6 +690,561 @@ enum CardBrand { JCB. """ JCB + + """ + UnionPay. + """ + UNIONPAY + + """ + Elo. + """ + ELO +} + +""" +A cart represents the merchandise that a buyer intends to purchase, and the estimated cost associated with the cart. +""" +type Cart implements Node { + """ + The attributes associated with the cart. Attributes are represented as key-value pairs. + """ + attributes: [Attribute!]! + + """ + Information about the buyer that is interacting with the cart. + """ + buyerIdentity: CartBuyerIdentity! + + """ + The URL of the checkout for the cart. + """ + checkoutUrl: URL! + + """ + The date and time when the cart was created. + """ + createdAt: DateTime! + + """ + The discount codes that have been applied to the cart. + """ + discountCodes: [CartDiscountCode!]! + + """ + The estimated costs that the buyer will pay at checkout. + """ + estimatedCost: CartEstimatedCost! + + """ + Globally unique identifier. + """ + id: ID! + + """ + A list of lines containing information about the items the customer intends to purchase. + """ + lines( + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): CartLineConnection! + + """ + A note that is associated with the cart. For example, the note can be a personalized message to the buyer. + """ + note: String + + """ + The date and time when the cart was updated. + """ + updatedAt: DateTime! +} + +""" +Return type for `cartAttributesUpdate` mutation. +""" +type CartAttributesUpdatePayload { + """ + The updated cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +The discounts automatically applied to the cart line based on prerequisites that have been met. +""" +type CartAutomaticDiscountAllocation implements CartDiscountAllocation { + """ + The discounted amount that has been applied to the cart line. + """ + discountedAmount: MoneyV2! + + """ + The title of the allocated discount. + """ + title: String! +} + +""" +Represents information about the buyer that is interacting with the cart. +""" +type CartBuyerIdentity { + """ + The country where the buyer is located. + """ + countryCode: CountryCode + + """ + The customer account associated with the cart. + """ + customer: Customer + + """ + The email address of the buyer that is interacting with the cart. + """ + email: String + + """ + The phone number of the buyer that is interacting with the cart. + """ + phone: String +} + +""" +Specifies the input fields to update the buyer information associated with a cart. +""" +input CartBuyerIdentityInput { + """ + The email address of the buyer that is interacting with the cart. + """ + email: String + + """ + The phone number of the buyer that is interacting with the cart. + """ + phone: String + + """ + The country where the buyer is located. + """ + countryCode: CountryCode + + """ + The access token used to identify the customer associated with the cart. + """ + customerAccessToken: String +} + +""" +Return type for `cartBuyerIdentityUpdate` mutation. +""" +type CartBuyerIdentityUpdatePayload { + """ + The updated cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +The discount that has been applied to the cart line using a discount code. +""" +type CartCodeDiscountAllocation implements CartDiscountAllocation { + """ + The code used to apply the discount. + """ + code: String! + + """ + The discounted amount that has been applied to the cart line. + """ + discountedAmount: MoneyV2! +} + +""" +Return type for `cartCreate` mutation. +""" +type CartCreatePayload { + """ + The new cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +The discounts that have been applied to the cart line. +""" +interface CartDiscountAllocation { + """ + The discounted amount that has been applied to the cart line. + """ + discountedAmount: MoneyV2! +} + +""" +The discount codes applied to the cart. +""" +type CartDiscountCode { + """ + The code for the discount. + """ + code: String! +} + +""" +Return type for `cartDiscountCodesUpdate` mutation. +""" +type CartDiscountCodesUpdatePayload { + """ + The updated cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +Possible error codes that could be returned by CartUserError. +""" +enum CartErrorCode { + """ + The input value is invalid. + """ + INVALID + + """ + The input value should be less than the maximum value allowed. + """ + LESS_THAN + + """ + Merchandise line was not found in cart. + """ + INVALID_MERCHANDISE_LINE + + """ + Missing discount code. + """ + MISSING_DISCOUNT_CODE + + """ + Missing note. + """ + MISSING_NOTE +} + +""" +The estimated costs that the buyer will pay at checkout. +""" +type CartEstimatedCost { + """ + The estimated amount, before taxes and discounts, for the customer to pay at checkout. + """ + subtotalAmount: MoneyV2! + + """ + The estimated total amount for the customer to pay at checkout. + """ + totalAmount: MoneyV2! + + """ + The estimated duty amount for the customer to pay at checkout. + """ + totalDutyAmount: MoneyV2 + + """ + The estimated tax amount for the customer to pay at checkout. + """ + totalTaxAmount: MoneyV2 +} + +""" +Specifies the input fields to create a cart. +""" +input CartInput { + """ + An array of key-value pairs that contains additional information about the cart. + """ + attributes: [AttributeInput!] + + """ + A list of merchandise lines to add to the cart. + """ + lines: [CartLineInput!] + + """ + The discount codes to apply to the cart. + """ + discountCodes: [String!] + + """ + A note that is associated with the cart. For example, the note can be a personalized message to the buyer. + """ + note: String + + """ + The customer associated with the cart. + """ + buyerIdentity: CartBuyerIdentityInput +} + +""" +Represents information about the merchandise in the cart. +""" +type CartLine implements Node { + """ + The attributes associated with the cart line. Attributes are represented as key-value pairs. + """ + attributes: [Attribute!]! + + """ + The discounts that have been applied to the cart line. + """ + discountAllocations: [CartDiscountAllocation!]! + + """ + The estimated cost of the merchandise that the buyer will pay for at checkout. + """ + estimatedCost: CartLineEstimatedCost! + + """ + Globally unique identifier. + """ + id: ID! + + """ + The merchandise that the buyer intends to purchase. + """ + merchandise: Merchandise! + + """ + The quantity of the merchandise that the customer intends to purchase. + """ + quantity: Int! + + """ + The selling plan associated with the cart line and the effect that each selling plan has on variants when they're purchased. + """ + sellingPlanAllocation: SellingPlanAllocation +} + +""" +An auto-generated type for paginating through multiple CartLines. +""" +type CartLineConnection { + """ + A list of edges. + """ + edges: [CartLineEdge!]! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! +} + +""" +An auto-generated type which holds one CartLine and a cursor during pagination. +""" +type CartLineEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of CartLineEdge. + """ + node: CartLine! +} + +""" +The estimated cost of the merchandise line that the buyer will pay at checkout. +""" +type CartLineEstimatedCost { + """ + The estimated cost of the merchandise line before discounts. + """ + subtotalAmount: MoneyV2! + + """ + The estimated total cost of the merchandise line, without discounts. + """ + totalAmount: MoneyV2! +} + +""" +Specifies the input fields to create a merchandise line on a cart. +""" +input CartLineInput { + """ + An array of key-value pairs that contains additional information about the merchandise line. + """ + attributes: [AttributeInput!] + + """ + The quantity of the merchandise. + """ + quantity: Int = 1 + + """ + The identifier of the merchandise that the buyer intends to purchase. + """ + merchandiseId: ID! + + """ + The identifier of the selling plan that the merchandise is being purchased with. + """ + sellingPlanId: ID +} + +""" +Specifies the input fields to update a line item on a cart. +""" +input CartLineUpdateInput { + """ + An array of key-value pairs that contains additional information about the merchandise line. + """ + attributes: [AttributeInput!] + + """ + The quantity of the line item. + """ + quantity: Int + + """ + The identifier of the merchandise for the line item. + """ + merchandiseId: ID + + """ + The identifier of the selling plan that the merchandise is being purchased with. + """ + sellingPlanId: ID + + """ + The identifier of the merchandise line. + """ + id: ID +} + +""" +Return type for `cartLinesAdd` mutation. +""" +type CartLinesAddPayload { + """ + The updated cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +Return type for `cartLinesRemove` mutation. +""" +type CartLinesRemovePayload { + """ + The updated cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +Return type for `cartLinesUpdate` mutation. +""" +type CartLinesUpdatePayload { + """ + The updated cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +Return type for `cartNoteUpdate` mutation. +""" +type CartNoteUpdatePayload { + """ + The updated cart. + """ + cart: Cart + + """ + The list of errors that occurred from executing the mutation. + """ + userErrors: [CartUserError!]! +} + +""" +Represents an error that happens during execution of a cart mutation. +""" +type CartUserError implements DisplayableError { + """ + The error code. + """ + code: CartErrorCode + + """ + The path to the input field that caused the error. + """ + field: [String!] + + """ + The error message. + """ + message: String! } """ @@ -603,6 +1263,11 @@ type Checkout implements Node { """ availableShippingRates: AvailableShippingRates + """ + The identity of the customer associated with the checkout. + """ + buyerIdentity: CheckoutBuyerIdentity! + """ The date and time when the checkout was completed. """ @@ -779,6 +1444,11 @@ type Checkout implements Node { """ taxesIncluded: Boolean! + """ + The sum of all the duties applied to the line items in the checkout. + """ + totalDuties: MoneyV2 + """ The sum of all the prices of all the items in the checkout, taxes and discounts included. """ @@ -827,9 +1497,10 @@ input CheckoutAttributesUpdateInput { """ Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. - Full validation of the addresses is still done at complete time. + Full validation of the addresses is still done at completion time. Defaults to `false` with + each operation. """ - allowPartialAddresses: Boolean + allowPartialAddresses: Boolean = false } """ @@ -842,12 +1513,12 @@ type CheckoutAttributesUpdatePayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -870,9 +1541,10 @@ input CheckoutAttributesUpdateV2Input { """ Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. - Full validation of the addresses is still done at complete time. + Full validation of the addresses is still done at completion time. Defaults to `false` with + each operation. """ - allowPartialAddresses: Boolean + allowPartialAddresses: Boolean = false } """ @@ -885,17 +1557,39 @@ type CheckoutAttributesUpdateV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") } +""" +The identity of the customer associated with the checkout. +""" +type CheckoutBuyerIdentity { + """ + The country code for the checkout. For example, `CA`. + """ + countryCode: CountryCode +} + +""" +Specifies the identity of the customer associated with the checkout. +""" +input CheckoutBuyerIdentityInput { + """ + The country code of one of the shop's + [enabled countries](https://help.shopify.com/en/manual/payments/shopify-payments/multi-currency/setup). + For example, `CA`. Including this field creates a checkout in the specified country's currency. + """ + countryCode: CountryCode! +} + """ Return type for `checkoutCompleteFree` mutation. """ @@ -906,12 +1600,12 @@ type CheckoutCompleteFreePayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -927,7 +1621,7 @@ type CheckoutCompleteWithCreditCardPayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! @@ -937,7 +1631,7 @@ type CheckoutCompleteWithCreditCardPayload { payment: Payment """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -953,7 +1647,7 @@ type CheckoutCompleteWithCreditCardV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! @@ -963,7 +1657,7 @@ type CheckoutCompleteWithCreditCardV2Payload { payment: Payment """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -979,7 +1673,7 @@ type CheckoutCompleteWithTokenizedPaymentPayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! @@ -989,7 +1683,7 @@ type CheckoutCompleteWithTokenizedPaymentPayload { payment: Payment """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1005,7 +1699,7 @@ type CheckoutCompleteWithTokenizedPaymentV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! @@ -1015,7 +1709,7 @@ type CheckoutCompleteWithTokenizedPaymentV2Payload { payment: Payment """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1031,7 +1725,7 @@ type CheckoutCompleteWithTokenizedPaymentV3Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! @@ -1041,7 +1735,7 @@ type CheckoutCompleteWithTokenizedPaymentV3Payload { payment: Payment """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1079,7 +1773,7 @@ input CheckoutCreateInput { """ Allows setting partial addresses on a Checkout, skipping the full validation of attributes. The required attributes are city, province, and country. - Full validation of addresses is still done at complete time. + Full validation of addresses is still done at completion time. Defaults to `null`. """ allowPartialAddresses: Boolean @@ -1087,8 +1781,14 @@ input CheckoutCreateInput { The three-letter currency code of one of the shop's enabled presentment currencies. Including this field creates a checkout in the specified currency. By default, new checkouts are created in the shop's primary currency. + This argument is deprecated: Use `country` field instead. """ presentmentCurrencyCode: CurrencyCode + + """ + The identity of the customer associated with the checkout. + """ + buyerIdentity: CheckoutBuyerIdentityInput } """ @@ -1101,12 +1801,17 @@ type CheckoutCreatePayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The checkout queue token. + """ + queueToken: String + + """ + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1127,7 +1832,7 @@ type CheckoutCustomerAssociatePayload { customer: Customer """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! } @@ -1142,7 +1847,7 @@ type CheckoutCustomerAssociateV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! @@ -1152,7 +1857,7 @@ type CheckoutCustomerAssociateV2Payload { customer: Customer """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1168,12 +1873,12 @@ type CheckoutCustomerDisassociatePayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1189,12 +1894,12 @@ type CheckoutCustomerDisassociateV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1210,12 +1915,12 @@ type CheckoutDiscountCodeApplyPayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1231,12 +1936,12 @@ type CheckoutDiscountCodeApplyV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1252,12 +1957,12 @@ type CheckoutDiscountCodeRemovePayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1273,12 +1978,12 @@ type CheckoutEmailUpdatePayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1294,12 +1999,12 @@ type CheckoutEmailUpdateV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1310,37 +2015,37 @@ Possible error codes that could be returned by CheckoutUserError. """ enum CheckoutErrorCode { """ - Input value is blank. + The input value is blank. """ BLANK """ - Input value is invalid. + The input value is invalid. """ INVALID """ - Input value is too long. + The input value is too long. """ TOO_LONG """ - Input value is not present. + The input value needs to be blank. """ PRESENT """ - Input value should be less than maximum allowed value. + The input value should be less than the maximum value allowed. """ LESS_THAN """ - Input value should be greater than or equal to minimum allowed value. + The input value should be greater than or equal to the minimum value allowed. """ GREATER_THAN_OR_EQUAL_TO """ - Input value should be less or equal to maximum allowed value. + The input value should be less than or equal to the maximum value allowed. """ LESS_THAN_OR_EQUAL_TO @@ -1498,6 +2203,26 @@ enum CheckoutErrorCode { Discount already applied. """ DISCOUNT_ALREADY_APPLIED + + """ + Throttled during checkout. + """ + THROTTLED_DURING_CHECKOUT + + """ + Queue token has expired. + """ + EXPIRED_QUEUE_TOKEN + + """ + Queue token is invalid. + """ + INVALID_QUEUE_TOKEN + + """ + Cannot specify country and presentment currency code. + """ + INVALID_COUNTRY_AND_CURRENCY } """ @@ -1510,12 +2235,12 @@ type CheckoutGiftCardApplyPayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1531,12 +2256,12 @@ type CheckoutGiftCardRemovePayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1552,12 +2277,12 @@ type CheckoutGiftCardRemoveV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1573,12 +2298,12 @@ type CheckoutGiftCardsAppendPayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1709,12 +2434,12 @@ type CheckoutLineItemsAddPayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1730,12 +2455,12 @@ type CheckoutLineItemsRemovePayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1751,7 +2476,7 @@ type CheckoutLineItemsReplacePayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [CheckoutUserError!]! } @@ -1766,12 +2491,12 @@ type CheckoutLineItemsUpdatePayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1787,12 +2512,12 @@ type CheckoutShippingAddressUpdatePayload { checkout: Checkout! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1808,12 +2533,12 @@ type CheckoutShippingAddressUpdateV2Payload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1829,12 +2554,12 @@ type CheckoutShippingLineUpdatePayload { checkout: Checkout """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ checkoutUserErrors: [CheckoutUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `checkoutUserErrors` instead") @@ -1845,12 +2570,12 @@ Represents an error that happens during execution of a checkout mutation. """ type CheckoutUserError implements DisplayableError { """ - Error code to uniquely identify the error. + The error code. """ code: CheckoutErrorCode """ - Path to the input field which caused the error. + The path to the input field that caused the error. """ field: [String!] @@ -1863,7 +2588,7 @@ type CheckoutUserError implements DisplayableError { """ A collection represents a grouping of products that a shop owner can create to organize them or make their shops easier to browse. """ -type Collection implements Node { +type Collection implements Node & HasMetafields { """ Stripped description of the collection, single line with HTML tags removed. """ @@ -1915,6 +2640,56 @@ type Collection implements Node { scale: Int = 1 ): Image + """ + Returns a metafield found by namespace and key. + """ + metafield( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String! + + """ + Identifier for the metafield (maximum of 30 characters). + """ + key: String! + ): Metafield + + """ + A paginated list of metafields associated with the resource. + """ + metafields( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String + + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): MetafieldConnection! + """ List of products in the collection. """ @@ -1948,6 +2723,11 @@ type Collection implements Node { Sort the underlying list by the given key. """ sortKey: ProductCollectionSortKeys = COLLECTION_DEFAULT + + """ + Returns a subset of products matching all product filters. + """ + filters: [ProductFilter!] ): ProductConnection! """ @@ -2093,6 +2873,31 @@ type CommentEdge { node: Comment! } +""" +A country. +""" +type Country { + """ + The currency of the country. + """ + currency: Currency! + + """ + The ISO code of the country. + """ + isoCode: CountryCode! + + """ + The name of the country. + """ + name: String! + + """ + The unit system used in the country. + """ + unitSystem: UnitSystem! +} + """ ISO 3166-1 alpha-2 country codes with some differences. """ @@ -3316,6 +4121,11 @@ enum CountryCode { Zimbabwe. """ ZW + + """ + Unknown Region. + """ + ZZ } """ @@ -3391,7 +4201,7 @@ input CreditCardPaymentInput { """ Executes the payment in test mode if possible. Defaults to `false`. """ - test: Boolean + test: Boolean = false } """ @@ -3422,7 +4232,7 @@ input CreditCardPaymentInputV2 { """ Executes the payment in test mode if possible. Defaults to `false`. """ - test: Boolean + test: Boolean = false } """ @@ -3455,6 +4265,26 @@ enum CropRegion { RIGHT } +""" +A currency. +""" +type Currency { + """ + The ISO code of the currency. + """ + isoCode: CurrencyCode! + + """ + The name of the currency. + """ + name: String! + + """ + The symbol of the currency. + """ + symbol: String! +} + """ Currency codes. """ @@ -4248,12 +5078,17 @@ enum CurrencyCode { Venezuelan Bolivares (VES). """ VES + + """ + Unrecognized currency. + """ + XXX } """ A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout. """ -type Customer { +type Customer implements HasMetafields { """ Indicates whether the customer has consented to be sent marketing material via email. """ @@ -4329,6 +5164,56 @@ type Customer { """ lastName: String + """ + Returns a metafield found by namespace and key. + """ + metafield( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String! + + """ + Identifier for the metafield (maximum of 30 characters). + """ + key: String! + ): Metafield + + """ + A paginated list of metafields associated with the resource. + """ + metafields( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String + + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): MetafieldConnection! + """ The orders associated with the customer. """ @@ -4430,12 +5315,12 @@ type CustomerAccessTokenCreatePayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4451,7 +5336,7 @@ type CustomerAccessTokenCreateWithMultipassPayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! } @@ -4471,7 +5356,7 @@ type CustomerAccessTokenDeletePayload { deletedCustomerAccessTokenId: String """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! } @@ -4486,7 +5371,7 @@ type CustomerAccessTokenRenewPayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! } @@ -4506,7 +5391,7 @@ type CustomerActivateByUrlPayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! } @@ -4541,12 +5426,12 @@ type CustomerActivatePayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4562,12 +5447,12 @@ type CustomerAddressCreatePayload { customerAddress: MailingAddress """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4578,7 +5463,7 @@ Return type for `customerAddressDelete` mutation. """ type CustomerAddressDeletePayload { """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! @@ -4588,7 +5473,7 @@ type CustomerAddressDeletePayload { deletedCustomerAddressId: String """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4604,12 +5489,12 @@ type CustomerAddressUpdatePayload { customerAddress: MailingAddress """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4662,12 +5547,12 @@ type CustomerCreatePayload { customer: Customer """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4683,12 +5568,12 @@ type CustomerDefaultAddressUpdatePayload { customer: Customer """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4699,27 +5584,27 @@ Possible error codes that could be returned by CustomerUserError. """ enum CustomerErrorCode { """ - Input value is blank. + The input value is blank. """ BLANK """ - Input value is invalid. + The input value is invalid. """ INVALID """ - Input value is already taken. + The input value is already taken. """ TAKEN """ - Input value is too long. + The input value is too long. """ TOO_LONG """ - Input value is too short. + The input value is too short. """ TOO_SHORT @@ -4779,12 +5664,12 @@ Return type for `customerRecover` mutation. """ type CustomerRecoverPayload { """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4805,12 +5690,12 @@ type CustomerResetByUrlPayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4846,12 +5731,12 @@ type CustomerResetPayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4910,12 +5795,12 @@ type CustomerUpdatePayload { customerAccessToken: CustomerAccessToken """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ customerUserErrors: [CustomerUserError!]! """ - List of errors that occurred executing the mutation. + The list of errors that occurred from executing the mutation. """ userErrors: [UserError!]! @deprecated(reason: "Use `customerUserErrors` instead") @@ -4926,12 +5811,12 @@ Represents an error that happens during execution of a customer mutation. """ type CustomerUserError implements DisplayableError { """ - Error code to uniquely identify the error. + The error code. """ code: CustomerErrorCode """ - Path to the input field which caused the error. + The path to the input field that caused the error. """ field: [String!] @@ -5144,7 +6029,7 @@ Represents an error in the input of a mutation. """ interface DisplayableError { """ - Path to the input field which caused the error. + The path to the input field that caused the error. """ field: [String!] @@ -5188,6 +6073,11 @@ type ExternalVideo implements Node & Media { """ embeddedUrl: URL! + """ + The host of the external video. + """ + host: MediaHost! + """ Globally unique identifier. """ @@ -5204,6 +6094,71 @@ type ExternalVideo implements Node & Media { previewImage: Image } +""" +A group of filters that are supported for the parent field. +""" +type FilterGroup { + """ + A unique identifier. + """ + id: String! + + """ + A human-friendly string for the filter group. + """ + label: String! + + """ + An Enum that denotes the type of data this filter group represents. + """ + type: FilterType! + + """ + The list of options for this filter group. + """ + values: [FilterValue!]! +} + +""" +Denotes the type of data this filter group represents. +""" +enum FilterType { + """ + A list of selectable values. + """ + LIST + + """ + A range of prices. + """ + PRICE_RANGE +} + +""" +A selectable option for a specific filter group. +""" +type FilterValue { + """ + A count of the number of objects matching this filter option. + """ + count: Int! + + """ + The parameters used to select this option as a filter on the parent field. + """ + filterParams: JSON! + + """ + A unique identifier. + """ + id: String! + + """ + A human-friendly string for the filter group. + """ + label: String! +} + """ Represents a single fulfillment in an order. """ @@ -5315,6 +6270,21 @@ type FulfillmentTrackingInfo { url: URL } +""" +Used to specify a geographical location. +""" +input GeoCoordinateInput { + """ + The coordinate's latitude value. + """ + latitude: Float! + + """ + The coordinate's longitude value. + """ + longitude: Float! +} + """ A string containing HTML code. Example value: `"

Grey cotton knit sweater.

"`. """ @@ -5325,7 +6295,7 @@ Represents information about the metafields associated to the specified resource """ interface HasMetafields { """ - The metafield associated with the resource. + Returns a metafield found by namespace and key. """ metafield( """ @@ -5498,6 +6468,167 @@ type ImageEdge { node: Image! } +""" +A JSON Object. Example value: `{ "key1": "Value 1", "key2": "Value 2", "key3": 3 }` +""" +scalar JSON + +""" +Information about the localized experiences configured for the shop. +""" +type Localization { + """ + List of countries with enabled localized experiences. + """ + availableCountries: [Country!]! + + """ + The country of the active localized experience. Use the `@inContext` directive to change this value. + """ + country: Country! +} + +""" +Represents a location where product inventory is held. +""" +type Location implements Node { + """ + The address of the location. + """ + address: LocationAddress! + + """ + Globally unique identifier. + """ + id: ID! + + """ + The name of the location. + """ + name: String! +} + +""" +Represents the address of the location. +""" +type LocationAddress { + """ + The first line of the address for the location. + """ + address1: String + + """ + The second line of the address for the location. + """ + address2: String + + """ + The city of the location. + """ + city: String + + """ + The country of the location. + """ + country: String + + """ + The two-letter country code of the location. + """ + countryCode: String + + """ + A formatted version of the location address. + """ + formatted: [String!]! + + """ + The latitude coordinates of the location. + """ + latitude: Float + + """ + The longitude coordinates of the location. + """ + longitude: Float + + """ + The phone number of the location. + """ + phone: String + + """ + The province of the location. + """ + province: String + + """ + The code for the region of the address, such as the province, state, or district. + For example QC for Quebec, Canada. + """ + provinceCode: String + + """ + The ZIP code of the location. + """ + zip: String +} + +""" +An auto-generated type for paginating through multiple Locations. +""" +type LocationConnection { + """ + A list of edges. + """ + edges: [LocationEdge!]! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! +} + +""" +An auto-generated type which holds one Location and a cursor during pagination. +""" +type LocationEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of LocationEdge. + """ + node: Location! +} + +""" +The set of valid sort keys for the Location query. +""" +enum LocationSortKeys { + """ + Sort by the `id` value. + """ + ID + + """ + Sort by the `name` value. + """ + NAME + + """ + Sort by the `city` value. + """ + CITY + + """ + Sort by the `distance` value. + """ + DISTANCE +} + """ Represents a mailing address for customers and shipping. """ @@ -5813,6 +6944,21 @@ type MediaEdge { node: Media! } +""" +Host for a Media Resource. +""" +enum MediaHost { + """ + Host for YouTube embedded videos. + """ + YOUTUBE + + """ + Host for Vimeo embedded videos. + """ + VIMEO +} + """ Represents a Shopify hosted image. """ @@ -5843,6 +6989,11 @@ type MediaImage implements Node & Media { previewImage: Image } +""" +The merchandise to be purchased at checkout. +""" +union Merchandise = ProductVariant + """ Metafields represent custom metadata attached to a resource. Metafields can be sorted into namespaces and are comprised of keys, values, and value types. @@ -5878,6 +7029,12 @@ type Metafield implements Node { """ parentResource: MetafieldParentResource! + """ + The type name of the metafield. + See the list of [supported types](https://shopify.dev/apps/metafields/definitions/types). + """ + type: String! + """ The date and time when the storefront metafield was updated. """ @@ -5892,6 +7049,9 @@ type Metafield implements Node { Represents the metafield value type. """ valueType: MetafieldValueType! + @deprecated( + reason: "`valueType` is deprecated and replaced by `type` in API version 2021-07." + ) } """ @@ -5927,7 +7087,16 @@ type MetafieldEdge { """ A resource that the metafield belongs to. """ -union MetafieldParentResource = Product | ProductVariant +union MetafieldParentResource = + Article + | Blog + | Collection + | Customer + | Order + | Page + | Product + | ProductVariant + | Shop """ Metafield value types. @@ -5947,6 +7116,16 @@ enum MetafieldValueType { A json string metafield. """ JSON_STRING + + """ + A float metafield. + """ + FLOAT + + """ + A boolean metafield. + """ + BOOLEAN } """ @@ -6026,26 +7205,6 @@ input MoneyInput { """ A monetary value with currency. - -To format currencies, combine this type's amount and currencyCode fields with your client's locale. - -For example, in JavaScript you could use Intl.NumberFormat: - -```js -new Intl.NumberFormat(locale, { - style: 'currency', - currency: currencyCode -}).format(amount); -``` - -Other formatting libraries include: - -* iOS - [NumberFormatter](https://developer.apple.com/documentation/foundation/numberformatter) -* Android - [NumberFormat](https://developer.android.com/reference/java/text/NumberFormat.html) -* PHP - [NumberFormatter](http://php.net/manual/en/class.numberformatter.php) - -For a more general solution, the [Unicode CLDR number formatting database] is available with many implementations -(such as [TwitterCldr](https://github.com/twitter/twitter-cldr-rb)). """ type MoneyV2 { """ @@ -6094,7 +7253,122 @@ The schema’s entry-point for mutations. This acts as the public, top-level API """ type Mutation { """ - Updates the attributes of a checkout. + Updates the attributes on a cart. + """ + cartAttributesUpdate( + """ + An array of key-value pairs that contains additional information about the cart. + """ + attributes: [AttributeInput!]! + + """ + The ID of the cart. + """ + cartId: ID! + ): CartAttributesUpdatePayload + + """ + Updates customer information associated with a cart. + """ + cartBuyerIdentityUpdate( + """ + The ID of the cart. + """ + cartId: ID! + + """ + The customer associated with the cart. + """ + buyerIdentity: CartBuyerIdentityInput! + ): CartBuyerIdentityUpdatePayload + + """ + Creates a new cart. + """ + cartCreate( + """ + The fields used to create a cart. + """ + input: CartInput + ): CartCreatePayload + + """ + Updates the discount codes applied to the cart. + """ + cartDiscountCodesUpdate( + """ + The ID of the cart. + """ + cartId: ID! + + """ + The discount codes to apply to the cart. + """ + discountCodes: [String!] + ): CartDiscountCodesUpdatePayload + + """ + Adds a merchandise line to the cart. + """ + cartLinesAdd( + """ + A list of merchandise lines to add to the cart. + """ + lines: [CartLineInput!]! + + """ + The ID of the cart. + """ + cartId: ID! + ): CartLinesAddPayload + + """ + Removes one or more merchandise lines from the cart. + """ + cartLinesRemove( + """ + The ID of the cart. + """ + cartId: ID! + + """ + The merchandise line IDs to remove. + """ + lineIds: [ID!]! + ): CartLinesRemovePayload + + """ + Updates one or more merchandise lines on a cart. + """ + cartLinesUpdate( + """ + The ID of the cart. + """ + cartId: ID! + + """ + The merchandise lines to update. + """ + lines: [CartLineUpdateInput!]! + ): CartLinesUpdatePayload + + """ + Updates the note on the cart. + """ + cartNoteUpdate( + """ + The ID of the cart. + """ + cartId: ID! + + """ + The note on the cart. + """ + note: String + ): CartNoteUpdatePayload + + """ + Updates the attributes of a checkout if `allowPartialAddresses` is `true`. """ checkoutAttributesUpdate( """ @@ -6110,7 +7384,7 @@ type Mutation { @deprecated(reason: "Use `checkoutAttributesUpdateV2` instead") """ - Updates the attributes of a checkout. + Updates the attributes of a checkout if `allowPartialAddresses` is `true`. """ checkoutAttributesUpdateV2( """ @@ -6220,6 +7494,11 @@ type Mutation { The fields used to create a checkout. """ input: CheckoutCreateInput! + + """ + The checkout queue token. + """ + queueToken: String ): CheckoutCreatePayload """ @@ -6734,7 +8013,7 @@ interface Node { """ An order is a customer’s completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time they provides an email address, billing address and payment information. """ -type Order implements Node { +type Order implements Node & HasMetafields { """ The reason for the order's cancellation. Returns `null` if the order wasn't canceled. """ @@ -6755,6 +8034,11 @@ type Order implements Node { """ currentSubtotalPrice: MoneyV2! + """ + The total cost of duties for the order, including refunds. + """ + currentTotalDuties: MoneyV2 + """ The total amount of the order, including duties, taxes and discounts, minus amounts for line items that have been removed. """ @@ -6860,6 +8144,56 @@ type Order implements Node { reverse: Boolean = false ): OrderLineItemConnection! + """ + Returns a metafield found by namespace and key. + """ + metafield( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String! + + """ + Identifier for the metafield (maximum of 30 characters). + """ + key: String! + ): Metafield + + """ + A paginated list of metafields associated with the resource. + """ + metafields( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String + + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): MetafieldConnection! + """ Unique identifier for the order that appears on the order. For example, _#1000_ or _Store1001. @@ -6871,6 +8205,11 @@ type Order implements Node { """ orderNumber: Int! + """ + The total cost of duties charged at checkout. + """ + originalTotalDuties: MoneyV2 + """ The total price of the order before any applied edits. """ @@ -7063,6 +8402,11 @@ enum OrderFinancialStatus { Displayed as **Refunded**. """ REFUNDED + + """ + Displayed as **Expired**. + """ + EXPIRED } """ @@ -7104,6 +8448,11 @@ enum OrderFulfillmentStatus { """ IN_PROGRESS + """ + Displayed as **On hold**. + """ + ON_HOLD + """ Displayed as **Scheduled**. """ @@ -7215,7 +8564,7 @@ enum OrderSortKeys { """ Shopify merchants can create pages to hold static HTML content. Each Page object represents a custom page on the online store. """ -type Page implements Node { +type Page implements Node & HasMetafields { """ The description of the page, complete with HTML formatting. """ @@ -7241,6 +8590,56 @@ type Page implements Node { """ id: ID! + """ + Returns a metafield found by namespace and key. + """ + metafield( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String! + + """ + Identifier for the metafield (maximum of 30 characters). + """ + key: String! + ): Metafield + + """ + A paginated list of metafields associated with the resource. + """ + metafields( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String + + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): MetafieldConnection! + """ The page's SEO information. """ @@ -7464,6 +8863,26 @@ enum PaymentTokenType { Google Pay token type. """ GOOGLE_PAY + + """ + Stripe token type. + """ + STRIPE_VAULT_TOKEN +} + +""" +A filter used to view a subset of products in a collection matching a specific price range. +""" +input PriceRangeFilter { + """ + The minimum price in the range. Defaults to zero. + """ + min: Float = 0 + + """ + The maximum price in the range. Empty indicates no max price. + """ + max: Float } """ @@ -7648,7 +9067,7 @@ type Product implements Node & HasMetafields { ): MediaConnection! """ - The metafield associated with the resource. + Returns a metafield found by namespace and key. """ metafield( """ @@ -7747,6 +9166,7 @@ type Product implements Node & HasMetafields { """ reverse: Boolean = false ): ProductPriceRangeConnection! + @deprecated(reason: "Use `@inContext` instead.") """ The price range. @@ -7763,6 +9183,41 @@ type Product implements Node & HasMetafields { """ publishedAt: DateTime! + """ + Whether the product can only be purchased with a selling plan. + """ + requiresSellingPlan: Boolean! + + """ + A list of a product's available selling plan groups. A selling plan group represents a selling method. For example, 'Subscribe and save' is a selling method where customers pay for goods or services per delivery. A selling plan group contains individual selling plans. + """ + sellingPlanGroups( + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): SellingPlanGroupConnection! + """ The product's SEO information. """ @@ -7901,6 +9356,11 @@ type ProductConnection { """ edges: [ProductEdge!]! + """ + A list of available filters. + """ + filters: [FilterGroup!]! + """ Information to aid in pagination. """ @@ -7922,6 +9382,36 @@ type ProductEdge { node: Product! } +""" +A filter used to view a subset of products in a collection. +""" +input ProductFilter { + """ + Filter on if the product is in stock. + """ + inStock: Boolean + + """ + A variant option to filter on. + """ + variantOption: VariantOptionFilter + + """ + The product type to filter on. + """ + productType: String + + """ + The product vendor to filter on. + """ + productVendor: String + + """ + A range of prices to filter with-in. + """ + price: PriceRangeFilter +} + """ The set of valid sort keys for the ProductImage query. """ @@ -8150,7 +9640,7 @@ type ProductVariant implements Node & HasMetafields { ): Image """ - The metafield associated with the resource. + Returns a metafield found by namespace and key. """ metafield( """ @@ -8233,6 +9723,7 @@ type ProductVariant implements Node & HasMetafields { """ reverse: Boolean = false ): ProductVariantPricePairConnection! + @deprecated(reason: "Use `@inContext` instead.") """ List of unit prices in the presentment currencies for this shop. @@ -8267,7 +9758,7 @@ type ProductVariant implements Node & HasMetafields { Reverse the order of the underlying list. """ reverse: Boolean = false - ): MoneyV2Connection! + ): MoneyV2Connection! @deprecated(reason: "Use `@inContext` instead.") """ The product variant’s price. @@ -8299,11 +9790,71 @@ type ProductVariant implements Node & HasMetafields { """ selectedOptions: [SelectedOption!]! + """ + Represents an association between a variant and a selling plan. Selling plan allocations describe which selling plans are available for each variant, and what their impact is on pricing. + """ + sellingPlanAllocations( + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): SellingPlanAllocationConnection! + """ The SKU (stock keeping unit) associated with the variant. """ sku: String + """ + The in-store pickup availability of this variant by location. + """ + storeAvailability( + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): StoreAvailabilityConnection! + """ The product variant’s title. """ @@ -8546,6 +10097,16 @@ type QueryRoot { query: String ): BlogConnection! + """ + Find a cart by its ID. + """ + cart( + """ + The id of the cart. + """ + id: ID! + ): Cart + """ Find a collection by its handle. """ @@ -8612,6 +10173,53 @@ type QueryRoot { customerAccessToken: String! ): Customer + """ + Returns the localized experiences configured for the shop. + """ + localization: Localization! + + """ + List of the shop's locations that support in-store pickup. + + When sorting by distance, you must specify a location via the `near` argument. + """ + locations( + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + + """ + Sort the underlying list by the given key. + """ + sortKey: LocationSortKeys = ID + + """ + Used to sort results based on proximity to the provided location. + """ + near: GeoCoordinateInput + ): LocationConnection! + """ Returns a specific node by ID. """ @@ -8876,6 +10484,304 @@ input SelectedOptionInput { value: String! } +""" +Represents how products and variants can be sold and purchased. +""" +type SellingPlan { + """ + The description of the selling plan. + """ + description: String + + """ + A globally unique identifier. + """ + id: ID! + + """ + The name of the selling plan. For example, '6 weeks of prepaid granola, delivered weekly'. + """ + name: String! + + """ + Represents the selling plan options available in the drop-down list in the storefront. For example, 'Delivery every week' or 'Delivery every 2 weeks' specifies the delivery frequency options for the product. + """ + options: [SellingPlanOption!]! + + """ + Represents how a selling plan affects pricing when a variant is purchased with a selling plan. + """ + priceAdjustments: [SellingPlanPriceAdjustment!]! + + """ + Whether purchasing the selling plan will result in multiple deliveries. + """ + recurringDeliveries: Boolean! +} + +""" +Represents an association between a variant and a selling plan. Selling plan allocations describe the options offered for each variant, and the price of the variant when purchased with a selling plan. +""" +type SellingPlanAllocation { + """ + A list of price adjustments, with a maximum of two. When there are two, the first price adjustment goes into effect at the time of purchase, while the second one starts after a certain number of orders. + """ + priceAdjustments: [SellingPlanAllocationPriceAdjustment!]! + + """ + A representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'. + """ + sellingPlan: SellingPlan! +} + +""" +An auto-generated type for paginating through multiple SellingPlanAllocations. +""" +type SellingPlanAllocationConnection { + """ + A list of edges. + """ + edges: [SellingPlanAllocationEdge!]! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! +} + +""" +An auto-generated type which holds one SellingPlanAllocation and a cursor during pagination. +""" +type SellingPlanAllocationEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of SellingPlanAllocationEdge. + """ + node: SellingPlanAllocation! +} + +""" +The resulting prices for variants when they're purchased with a specific selling plan. +""" +type SellingPlanAllocationPriceAdjustment { + """ + The price of the variant when it's purchased without a selling plan for the same number of deliveries. For example, if a customer purchases 6 deliveries of $10.00 granola separately, then the price is 6 x $10.00 = $60.00. + """ + compareAtPrice: MoneyV2! + + """ + The effective price for a single delivery. For example, for a prepaid subscription plan that includes 6 deliveries at the price of $48.00, the per delivery price is $8.00. + """ + perDeliveryPrice: MoneyV2! + + """ + The price of the variant when it's purchased with a selling plan For example, for a prepaid subscription plan that includes 6 deliveries of $10.00 granola, where the customer gets 20% off, the price is 6 x $10.00 x 0.80 = $48.00. + """ + price: MoneyV2! + + """ + The resulting price per unit for the variant associated with the selling plan. If the variant isn't sold by quantity or measurement, then this field returns `null`. + """ + unitPrice: MoneyV2 +} + +""" +An auto-generated type for paginating through multiple SellingPlans. +""" +type SellingPlanConnection { + """ + A list of edges. + """ + edges: [SellingPlanEdge!]! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! +} + +""" +An auto-generated type which holds one SellingPlan and a cursor during pagination. +""" +type SellingPlanEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of SellingPlanEdge. + """ + node: SellingPlan! +} + +""" +A fixed amount that's deducted from the original variant price. For example, $10.00 off. +""" +type SellingPlanFixedAmountPriceAdjustment { + """ + The money value of the price adjustment. + """ + adjustmentAmount: MoneyV2! +} + +""" +A fixed price adjustment for a variant that's purchased with a selling plan. +""" +type SellingPlanFixedPriceAdjustment { + """ + A new price of the variant when it's purchased with the selling plan. + """ + price: MoneyV2! +} + +""" +Represents a selling method. For example, 'Subscribe and save' is a selling method where customers pay for goods or services per delivery. A selling plan group contains individual selling plans. +""" +type SellingPlanGroup { + """ + A display friendly name for the app that created the selling plan group. + """ + appName: String + + """ + The name of the selling plan group. + """ + name: String! + + """ + Represents the selling plan options available in the drop-down list in the storefront. For example, 'Delivery every week' or 'Delivery every 2 weeks' specifies the delivery frequency options for the product. + """ + options: [SellingPlanGroupOption!]! + + """ + A list of selling plans in a selling plan group. A selling plan is a representation of how products and variants can be sold and purchased. For example, an individual selling plan could be '6 weeks of prepaid granola, delivered weekly'. + """ + sellingPlans( + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): SellingPlanConnection! +} + +""" +An auto-generated type for paginating through multiple SellingPlanGroups. +""" +type SellingPlanGroupConnection { + """ + A list of edges. + """ + edges: [SellingPlanGroupEdge!]! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! +} + +""" +An auto-generated type which holds one SellingPlanGroup and a cursor during pagination. +""" +type SellingPlanGroupEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of SellingPlanGroupEdge. + """ + node: SellingPlanGroup! +} + +""" +Represents an option on a selling plan group that's available in the drop-down list in the storefront. +""" +type SellingPlanGroupOption { + """ + The name of the option. For example, 'Delivery every'. + """ + name: String! + + """ + The values for the options specified by the selling plans in the selling plan group. For example, '1 week', '2 weeks', '3 weeks'. + """ + values: [String!]! +} + +""" +An option provided by a Selling Plan. +""" +type SellingPlanOption { + """ + The name of the option (ie "Delivery every"). + """ + name: String + + """ + The value of the option (ie "Month"). + """ + value: String +} + +""" +A percentage amount that's deducted from the original variant price. For example, 10% off. +""" +type SellingPlanPercentagePriceAdjustment { + """ + The percentage value of the price adjustment. + """ + adjustmentPercentage: Int! +} + +""" +Represents by how much the price of a variant associated with a selling plan is adjusted. Each variant can have up to two price adjustments. +""" +type SellingPlanPriceAdjustment { + """ + The type of price adjustment. An adjustment value can have one of three types: percentage, amount off, or a new price. + """ + adjustmentValue: SellingPlanPriceAdjustmentValue! + + """ + The number of orders that the price adjustment applies to If the price adjustment always applies, then this field is `null`. + """ + orderCount: Int +} + +""" +Represents by how much the price of a variant associated with a selling plan is adjusted. Each variant can have up to two price adjustments. +""" +union SellingPlanPriceAdjustmentValue = + SellingPlanFixedAmountPriceAdjustment + | SellingPlanFixedPriceAdjustment + | SellingPlanPercentagePriceAdjustment + """ A shipping rate to be applied to a checkout. """ @@ -8904,7 +10810,7 @@ type ShippingRate { """ Shop represents a collection of the general settings and information about the shop. """ -type Shop { +type Shop implements HasMetafields { """ List of the shop' articles. """ @@ -9069,6 +10975,56 @@ type Shop { """ description: String + """ + Returns a metafield found by namespace and key. + """ + metafield( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String! + + """ + Identifier for the metafield (maximum of 30 characters). + """ + key: String! + ): Metafield + + """ + A paginated list of metafields associated with the resource. + """ + metafields( + """ + Container for a set of metafields (maximum of 20 characters). + """ + namespace: String + + """ + Returns up to the first `n` elements from the list. + """ + first: Int + + """ + Returns the elements that come after the specified cursor. + """ + after: String + + """ + Returns up to the last `n` elements from the list. + """ + last: Int + + """ + Returns the elements that come before the specified cursor. + """ + before: String + + """ + Reverse the order of the underlying list. + """ + reverse: Boolean = false + ): MetafieldConnection! + """ A string representing the way currency is formatted when the currency isn’t specified. """ @@ -9235,6 +11191,56 @@ type ShopPolicy implements Node { url: URL! } +""" +Describes the availability of a product variant at a particular location. +""" +type StoreAvailability { + """ + Whether or not this product variant is in-stock at this location. + """ + available: Boolean! + + """ + The location where this product variant is stocked at. + """ + location: Location! + + """ + Returns the estimated amount of time it takes for pickup to be ready (Example: Usually ready in 24 hours). + """ + pickUpTime: String! +} + +""" +An auto-generated type for paginating through multiple StoreAvailabilities. +""" +type StoreAvailabilityConnection { + """ + A list of edges. + """ + edges: [StoreAvailabilityEdge!]! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! +} + +""" +An auto-generated type which holds one StoreAvailability and a cursor during pagination. +""" +type StoreAvailabilityEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of StoreAvailabilityEdge. + """ + node: StoreAvailability! +} + """ An auto-generated type for paginating through multiple Strings. """ @@ -9298,7 +11304,7 @@ input TokenizedPaymentInput { """ Executes the payment in test mode if possible. Defaults to `false`. """ - test: Boolean + test: Boolean = false """ Public Hash Key used for AndroidPay payments only. @@ -9334,7 +11340,7 @@ input TokenizedPaymentInputV2 { """ Whether to execute the payment in test mode, if possible. Test mode is not supported in production stores. Defaults to `false`. """ - test: Boolean + test: Boolean = false """ Public Hash Key used for AndroidPay payments only. @@ -9375,7 +11381,7 @@ input TokenizedPaymentInputV3 { """ Whether to execute the payment in test mode, if possible. Test mode is not supported in production stores. Defaults to `false`. """ - test: Boolean + test: Boolean = false """ Public Hash Key used for AndroidPay payments only. @@ -9601,12 +11607,27 @@ enum UnitPriceMeasurementMeasuredUnit { M2 } +""" +Systems of weights and measures. +""" +enum UnitSystem { + """ + Imperial system of weights and measures. + """ + IMPERIAL_SYSTEM + + """ + Metric system of weights and measures. + """ + METRIC_SYSTEM +} + """ Represents an error in the input of a mutation. """ type UserError implements DisplayableError { """ - Path to the input field which caused the error. + The path to the input field that caused the error. """ field: [String!] @@ -9616,6 +11637,21 @@ type UserError implements DisplayableError { message: String! } +""" +A filter used to view a subset of products in a collection matching a specific variant option. +""" +input VariantOptionFilter { + """ + The name of the variant option to filter on. + """ + name: String! + + """ + The value of the variant option to filter on. + """ + value: String! +} + """ Represents a Shopify hosted video. """ diff --git a/framework/shopify/utils/cart-create.ts b/framework/shopify/utils/cart-create.ts new file mode 100644 index 000000000..3baa3edcf --- /dev/null +++ b/framework/shopify/utils/cart-create.ts @@ -0,0 +1,46 @@ +import Cookies from 'js-cookie' + +import { SHOPIFY_CART_ID_COOKIE, SHOPIFY_COOKIE_EXPIRE } from '../const' + +import cartCreateMutation from './mutations/cart-create' + +import { + CartCreateMutation, + CartCreateMutationVariables, + CartDetailsFragment, +} from '../schema' +import { FetcherOptions } from '@commerce/utils/types' +import { FetcherError } from '@commerce/utils/errors' + +export const cartCreate = async ( + fetch: (options: FetcherOptions) => Promise +): Promise<{ node: CartDetailsFragment }> => { + const { cartCreate } = await fetch< + CartCreateMutation, + CartCreateMutationVariables + >({ + query: cartCreateMutation, + }) + + const cart = cartCreate?.cart + + if (!cart) { + throw new FetcherError({ + status: 500, + errors: cartCreate?.userErrors?.map((e) => ({ + message: e.message, + })) ?? [{ message: 'Could not create cart' }], + }) + } + + if (cart?.id) { + const options = { + expires: SHOPIFY_COOKIE_EXPIRE, + } + Cookies.set(SHOPIFY_CART_ID_COOKIE, cart.id, options) + } + + return { node: cart } +} + +export default cartCreate diff --git a/framework/shopify/utils/checkout-to-cart.ts b/framework/shopify/utils/checkout-to-cart.ts deleted file mode 100644 index e2531cc78..000000000 --- a/framework/shopify/utils/checkout-to-cart.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { Cart } from '../types/cart' -import { CommerceError } from '@commerce/utils/errors' - -import { - CheckoutLineItemsAddPayload, - CheckoutLineItemsRemovePayload, - CheckoutLineItemsUpdatePayload, - CheckoutCreatePayload, - CheckoutUserError, - Checkout, - Maybe, -} from '../schema' - -import { normalizeCart } from './normalize' -import throwUserErrors from './throw-user-errors' - -export type CheckoutQuery = { - checkout: Checkout - checkoutUserErrors?: Array -} - -export type CheckoutPayload = - | CheckoutLineItemsAddPayload - | CheckoutLineItemsUpdatePayload - | CheckoutLineItemsRemovePayload - | CheckoutCreatePayload - | CheckoutQuery - -const checkoutToCart = (checkoutPayload?: Maybe): Cart => { - const checkout = checkoutPayload?.checkout - throwUserErrors(checkoutPayload?.checkoutUserErrors) - - if (!checkout) { - throw new CommerceError({ - message: 'Missing checkout object from response', - }) - } - - return normalizeCart(checkout) -} - -export default checkoutToCart diff --git a/framework/shopify/utils/get-cart-id.ts b/framework/shopify/utils/get-cart-id.ts new file mode 100644 index 000000000..0193edf31 --- /dev/null +++ b/framework/shopify/utils/get-cart-id.ts @@ -0,0 +1,8 @@ +import Cookies from 'js-cookie' +import { SHOPIFY_CART_ID_COOKIE } from '../const' + +const getCartId = (id?: string) => { + return id ?? Cookies.get(SHOPIFY_CART_ID_COOKIE) +} + +export default getCartId diff --git a/framework/shopify/utils/get-checkout-id.ts b/framework/shopify/utils/get-checkout-id.ts deleted file mode 100644 index 11e3802d9..000000000 --- a/framework/shopify/utils/get-checkout-id.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Cookies from 'js-cookie' -import { SHOPIFY_CHECKOUT_ID_COOKIE } from '../const' - -const getCheckoutId = (id?: string) => { - return id ?? Cookies.get(SHOPIFY_CHECKOUT_ID_COOKIE) -} - -export default getCheckoutId diff --git a/framework/shopify/utils/index.ts b/framework/shopify/utils/index.ts index a8454ffca..1a879f4fd 100644 --- a/framework/shopify/utils/index.ts +++ b/framework/shopify/utils/index.ts @@ -3,12 +3,12 @@ export { default as getSearchVariables } from './get-search-variables' export { default as getSortVariables } from './get-sort-variables' export { default as getBrands } from './get-brands' export { default as getCategories } from './get-categories' -export { default as getCheckoutId } from './get-checkout-id' -export { default as checkoutCreate } from './checkout-create' -export { default as checkoutToCart } from './checkout-to-cart' +export { default as getCartId } from './get-cart-id' +export { default as cartCreate } from './cart-create' export { default as handleLogin, handleAutomaticLogin } from './handle-login' export { default as handleAccountActivation } from './handle-account-activation' export { default as throwUserErrors } from './throw-user-errors' + export * from './queries' export * from './mutations' export * from './normalize' diff --git a/framework/shopify/utils/mutations/cart-create.ts b/framework/shopify/utils/mutations/cart-create.ts new file mode 100644 index 000000000..eccf231e7 --- /dev/null +++ b/framework/shopify/utils/mutations/cart-create.ts @@ -0,0 +1,18 @@ +import { cartDetailsFragment } from '../queries/get-cart-query' + +const cartCreateMutation = /* GraphQL */ ` + mutation cartCreate { + cartCreate { + cart { + ...cartDetails + } + userErrors { + code + field + message + } + } + } + ${cartDetailsFragment} +` +export default cartCreateMutation diff --git a/framework/shopify/utils/mutations/cart-line-item-add.ts b/framework/shopify/utils/mutations/cart-line-item-add.ts new file mode 100644 index 000000000..30cee424a --- /dev/null +++ b/framework/shopify/utils/mutations/cart-line-item-add.ts @@ -0,0 +1,18 @@ +import { cartDetailsFragment } from '../queries/get-cart-query' + +const cartLinesAddMutation = /* GraphQL */ ` + mutation cartLinesAdd($lines: [CartLineInput!]!, $cartId: ID!) { + cartLinesAdd(lines: $lines, cartId: $cartId) { + cart { + ...cartDetails + } + userErrors { + code + field + message + } + } + } + ${cartDetailsFragment} +` +export default cartLinesAddMutation diff --git a/framework/shopify/utils/mutations/cart-line-item-remove.ts b/framework/shopify/utils/mutations/cart-line-item-remove.ts new file mode 100644 index 000000000..861819733 --- /dev/null +++ b/framework/shopify/utils/mutations/cart-line-item-remove.ts @@ -0,0 +1,18 @@ +import { cartDetailsFragment } from '../queries/get-cart-query' + +const cartLinesAddMutation = /* GraphQL */ ` + mutation cartLinesRemove($cartId: ID!, $lineIds: [ID!]!) { + cartLinesRemove(cartId: $cartId, lineIds: $lineIds) { + cart { + ...cartDetails + } + userErrors { + code + field + message + } + } + } + ${cartDetailsFragment} +` +export default cartLinesAddMutation diff --git a/framework/shopify/utils/mutations/cart-line-item-update.ts b/framework/shopify/utils/mutations/cart-line-item-update.ts new file mode 100644 index 000000000..1f60e8232 --- /dev/null +++ b/framework/shopify/utils/mutations/cart-line-item-update.ts @@ -0,0 +1,18 @@ +import { cartDetailsFragment } from '../queries/get-cart-query' + +const cartLinesAddMutation = /* GraphQL */ ` + mutation cartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) { + cartLinesUpdate(cartId: $cartId, lines: $lines) { + cart { + ...cartDetails + } + userErrors { + code + field + message + } + } + } + ${cartDetailsFragment} +` +export default cartLinesAddMutation diff --git a/framework/shopify/utils/mutations/checkout-create.ts b/framework/shopify/utils/mutations/checkout-create.ts deleted file mode 100644 index 7bff7e757..000000000 --- a/framework/shopify/utils/mutations/checkout-create.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { checkoutDetailsFragment } from '../queries/get-checkout-query' - -const checkoutCreateMutation = /* GraphQL */ ` - mutation checkoutCreate($input: CheckoutCreateInput = {}) { - checkoutCreate(input: $input) { - checkoutUserErrors { - code - field - message - } - checkout { - ...checkoutDetails - } - } - } - - ${checkoutDetailsFragment} -` -export default checkoutCreateMutation diff --git a/framework/shopify/utils/mutations/checkout-line-item-add.ts b/framework/shopify/utils/mutations/checkout-line-item-add.ts deleted file mode 100644 index 02f5b7107..000000000 --- a/framework/shopify/utils/mutations/checkout-line-item-add.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { checkoutDetailsFragment } from '../queries/get-checkout-query' - -const checkoutLineItemAddMutation = /* GraphQL */ ` - mutation checkoutLineItemAdd( - $checkoutId: ID! - $lineItems: [CheckoutLineItemInput!]! - ) { - checkoutLineItemsAdd(checkoutId: $checkoutId, lineItems: $lineItems) { - checkoutUserErrors { - code - field - message - } - checkout { - ...checkoutDetails - } - } - } - - ${checkoutDetailsFragment} -` -export default checkoutLineItemAddMutation diff --git a/framework/shopify/utils/mutations/checkout-line-item-remove.ts b/framework/shopify/utils/mutations/checkout-line-item-remove.ts deleted file mode 100644 index 30cb83028..000000000 --- a/framework/shopify/utils/mutations/checkout-line-item-remove.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { checkoutDetailsFragment } from '../queries/get-checkout-query' - -const checkoutLineItemRemoveMutation = /* GraphQL */ ` - mutation checkoutLineItemRemove($checkoutId: ID!, $lineItemIds: [ID!]!) { - checkoutLineItemsRemove( - checkoutId: $checkoutId - lineItemIds: $lineItemIds - ) { - checkoutUserErrors { - code - field - message - } - checkout { - ...checkoutDetails - } - } - } - ${checkoutDetailsFragment} -` -export default checkoutLineItemRemoveMutation diff --git a/framework/shopify/utils/mutations/checkout-line-item-update.ts b/framework/shopify/utils/mutations/checkout-line-item-update.ts deleted file mode 100644 index fca617fb7..000000000 --- a/framework/shopify/utils/mutations/checkout-line-item-update.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { checkoutDetailsFragment } from '../queries/get-checkout-query' - -const checkoutLineItemUpdateMutation = /* GraphQL */ ` - mutation checkoutLineItemUpdate( - $checkoutId: ID! - $lineItems: [CheckoutLineItemUpdateInput!]! - ) { - checkoutLineItemsUpdate(checkoutId: $checkoutId, lineItems: $lineItems) { - checkoutUserErrors { - code - field - message - } - checkout { - ...checkoutDetails - } - } - } - - ${checkoutDetailsFragment} -` -export default checkoutLineItemUpdateMutation diff --git a/framework/shopify/utils/mutations/index.ts b/framework/shopify/utils/mutations/index.ts index 165fb192d..fafd1c52a 100644 --- a/framework/shopify/utils/mutations/index.ts +++ b/framework/shopify/utils/mutations/index.ts @@ -1,8 +1,8 @@ export { default as customerCreateMutation } from './customer-create' -export { default as checkoutCreateMutation } from './checkout-create' -export { default as checkoutLineItemAddMutation } from './checkout-line-item-add' -export { default as checkoutLineItemUpdateMutation } from './checkout-line-item-update' -export { default as checkoutLineItemRemoveMutation } from './checkout-line-item-remove' +export { default as cartCreateMutation } from './cart-create' +export { default as cartLineItemAddMutation } from './cart-line-item-add' +export { default as cartLineItemUpdateMutation } from './cart-line-item-update' +export { default as cartLineItemRemoveMutation } from './cart-line-item-remove' export { default as customerAccessTokenCreateMutation } from './customer-access-token-create' export { default as customerAccessTokenDeleteMutation } from './customer-access-token-delete' export { default as customerActivateMutation } from './customer-activate' diff --git a/framework/shopify/utils/normalize.ts b/framework/shopify/utils/normalize.ts index 96262f418..d466c3eb6 100644 --- a/framework/shopify/utils/normalize.ts +++ b/framework/shopify/utils/normalize.ts @@ -5,18 +5,18 @@ import type { Category } from '../types/site' import { Product as ShopifyProduct, - Checkout, - CheckoutLineItemEdge, SelectedOption, ImageConnection, - ProductVariantConnection, MoneyV2, ProductOption, Page as ShopifyPage, PageEdge, Collection, + CartDetailsFragment, + ProductVariantConnection, } from '../schema' import { colorMap } from '@lib/colors' +import { CommerceError } from '@commerce/utils/errors' const money = ({ amount, currencyCode }: MoneyV2) => { return { @@ -128,34 +128,41 @@ export function normalizeProduct({ } } -export function normalizeCart(checkout: Checkout): Cart { +export function normalizeCart( + cart: CartDetailsFragment | undefined | null +): Cart { + if (!cart) { + throw new CommerceError({ message: 'Missing cart details' }) + } + return { - id: checkout.id, - url: checkout.webUrl, - customerId: '', - email: '', - createdAt: checkout.createdAt, + id: cart.id, + customerId: cart.buyerIdentity?.customer?.id, + email: cart.buyerIdentity?.email ?? '', + createdAt: cart.createdAt, currency: { - code: checkout.totalPriceV2?.currencyCode, + code: cart.estimatedCost?.totalAmount?.currencyCode, }, - taxesIncluded: checkout.taxesIncluded, - lineItems: checkout.lineItems?.edges.map(normalizeLineItem), - lineItemsSubtotalPrice: +checkout.subtotalPriceV2?.amount, - subtotalPrice: +checkout.subtotalPriceV2?.amount, - totalPrice: checkout.totalPriceV2?.amount, + taxesIncluded: !!cart.estimatedCost?.totalTaxAmount, + lineItems: cart.lines?.edges?.map(normalizeLineItem) ?? [], + lineItemsSubtotalPrice: +cart.estimatedCost?.totalAmount, + subtotalPrice: +cart.estimatedCost?.subtotalAmount, + totalPrice: +cart.estimatedCost?.totalAmount, discounts: [], } } function normalizeLineItem({ - node: { id, title, variant, quantity }, -}: CheckoutLineItemEdge): LineItem { + node: { id, merchandise: variant, quantity }, +}: { + node: any +}): LineItem { return { id, variantId: String(variant?.id), productId: String(variant?.id), - name: `${title}`, - quantity, + name: `${variant?.title}`, + quantity: quantity ?? 0, variant: { id: String(variant?.id), sku: variant?.sku ?? '', diff --git a/framework/shopify/utils/queries/get-cart-query.ts b/framework/shopify/utils/queries/get-cart-query.ts new file mode 100644 index 000000000..ff608eb9e --- /dev/null +++ b/framework/shopify/utils/queries/get-cart-query.ts @@ -0,0 +1,58 @@ +export const cartDetailsFragment = /* GraphQL */ ` + fragment cartDetails on Cart { + id + checkoutUrl + createdAt + updatedAt + lines(first: 10) { + edges { + node { + id + merchandise { + ... on ProductVariant { + id + } + } + } + } + } + attributes { + key + value + } + buyerIdentity { + email + customer { + id + } + } + estimatedCost { + totalAmount { + amount + currencyCode + } + subtotalAmount { + amount + currencyCode + } + totalTaxAmount { + amount + currencyCode + } + totalDutyAmount { + amount + currencyCode + } + } + } +` + +const getCartQuery = /* GraphQL */ ` + query getCart($cartId: ID!) { + node(id: $cartId) { + ...cartDetails + } + } + ${cartDetailsFragment} +` +export default getCartQuery diff --git a/framework/shopify/utils/queries/get-checkout-query.ts b/framework/shopify/utils/queries/get-checkout-query.ts deleted file mode 100644 index 9969e67c0..000000000 --- a/framework/shopify/utils/queries/get-checkout-query.ts +++ /dev/null @@ -1,70 +0,0 @@ -export const checkoutDetailsFragment = /* GraphQL */ ` - fragment checkoutDetails on Checkout { - id - webUrl - subtotalPriceV2 { - amount - currencyCode - } - totalTaxV2 { - amount - currencyCode - } - totalPriceV2 { - amount - currencyCode - } - completedAt - createdAt - taxesIncluded - lineItems(first: 250) { - pageInfo { - hasNextPage - hasPreviousPage - } - edges { - node { - id - title - variant { - id - sku - title - selectedOptions { - name - value - } - image { - originalSrc - altText - width - height - } - priceV2 { - amount - currencyCode - } - compareAtPriceV2 { - amount - currencyCode - } - product { - handle - } - } - quantity - } - } - } - } -` - -const getCheckoutQuery = /* GraphQL */ ` - query getCheckout($checkoutId: ID!) { - node(id: $checkoutId) { - ...checkoutDetails - } - } - ${checkoutDetailsFragment} -` -export default getCheckoutQuery diff --git a/framework/shopify/utils/queries/index.ts b/framework/shopify/utils/queries/index.ts index 953113491..7181c94ce 100644 --- a/framework/shopify/utils/queries/index.ts +++ b/framework/shopify/utils/queries/index.ts @@ -4,7 +4,7 @@ export { default as getAllProductsQuery } from './get-all-products-query' export { default as getAllProductsPathtsQuery } from './get-all-products-paths-query' export { default as getAllProductVendors } from './get-all-product-vendors-query' export { default as getCollectionProductsQuery } from './get-collection-products-query' -export { default as getCheckoutQuery } from './get-checkout-query' +export { default as getCartQuery } from './get-cart-query' export { default as getAllPagesQuery } from './get-all-pages-query' export { default as getPageQuery } from './get-page-query' export { default as getCustomerQuery } from './get-customer-query' diff --git a/framework/shopify/utils/throw-user-errors.ts b/framework/shopify/utils/throw-user-errors.ts index 5488ba282..7f4bb1a32 100644 --- a/framework/shopify/utils/throw-user-errors.ts +++ b/framework/shopify/utils/throw-user-errors.ts @@ -5,13 +5,18 @@ import { CheckoutUserError, CustomerErrorCode, CustomerUserError, + CartUserError, + CartErrorCode, } from '../schema' -export type UserErrors = Array +export type UserErrors = Array< + CheckoutUserError | CustomerUserError | CartUserError +> export type UserErrorCode = | CustomerErrorCode | CheckoutErrorCode + | CartErrorCode | null | undefined diff --git a/tsconfig.json b/tsconfig.json index 340929669..c37583a0a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,8 +23,8 @@ "@components/*": ["components/*"], "@commerce": ["framework/commerce"], "@commerce/*": ["framework/commerce/*"], - "@framework": ["framework/local"], - "@framework/*": ["framework/local/*"] + "@framework": ["framework/shopify"], + "@framework/*": ["framework/shopify/*"] } }, "include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],