Cart/GraphQL

Cart/GraphQL

Methods

(static) "Cart.items"(cart, connectionArgs, context) → {Promise.<Object>}

converts the items prop on the provided cart to a connection

Source:
Parameters:
Name Type Description
cart Object

result of the parent resolver, which is a Cart object in GraphQL schema format

connectionArgs ConnectionArgs

An object of all arguments that were sent by the client

context Object

The per-request context object

Returns:

A connection object

Type
Promise.<Object>

(static) "Cart.totalItemQuantity"(cart, connectionArgs, context) → {Promise.<Number>}

Calculates the total quantity of items in the cart and returns a number

Source:
Parameters:
Name Type Description
cart Object

Result of the parent resolver, which is a Cart object in GraphQL schema format

connectionArgs Object

Connection args. (not used for this resolver)

context Object

An object containing the per-request state

Returns:

A promise that resolves to the number of the total item quantity

Type
Promise.<Number>

(static) "Mutation.addCartItems"(parentResult, context) → {Promise.<Object>}

resolver for the addCartItems GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

The opaque ID of the cart to add the items to.

clientMutationId String <optional>

An optional string identifying the mutation call

items String

An array of cart items to add to the new cart. Must not be empty.

token String <optional>

The anonymous access token that was returned from createCart. Required for anonymous carts.

context Object

an object containing the per-request state

Returns:

AddCartItemsPayload

Type
Promise.<Object>

(static) "Mutation.createCart"(parentResult, context) → {Promise.<Object>}

resolver for the createCart GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
clientMutationId String <optional>

An optional string identifying the mutation call

items String

An array of cart items to add to the new cart. Must not be empty.

shopId String

The ID of the shop that will own this cart

context Object

an object containing the per-request state

Returns:

CreateCartPayload

Type
Promise.<Object>

(static) "Mutation.reconcileCarts"(parentResult, context) → {Promise.<Object>}

resolver for the reconcileCarts GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
anonymousCartId String

The anonymous cart ID

anonymousCartToken String

The anonymous access token that was returned from createCart

clientMutationId String <optional>

An optional string identifying the mutation call

mode String <optional>

The reconciliation mode, "merge", "keepAccountCart", or "keepAnonymousCart". Default "merge"

context Object

an object containing the per-request state

Returns:

ReconcileCartsPayload

Type
Promise.<Object>

(static) "Mutation.removeCartItems"(parentResult, context) → {Promise.<Object>}

resolver for the removeCartItems GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

The ID of the cart in which all of the items exist

cartItemIds Array.<String>

Array of item IDs to update

token String

The token if the cart is an anonymous cart

clientMutationId String <optional>

An optional string identifying the mutation call

context Object

an object containing the per-request state

Returns:

RemoveCartItemsPayload

Type
Promise.<Object>

(static) "Mutation.selectFulfillmentOptionForGroup"(parentResult, context) → {Promise.<Object>}

resolver for the selectFulfillmentOptionForGroup GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

The ID of the cart to select a fulfillment option for

cartToken String <optional>

The token for the cart, required if it is an anonymous cart

fulfillmentGroupId String

The group to select a fulfillment option for

fulfillmentMethodId String

The fulfillment method ID from the option the shopper selected

clientMutationId String <optional>

An optional string identifying the mutation call

context Object

an object containing the per-request state

Returns:

SelectFulfillmentOptionForGroupPayload

Type
Promise.<Object>

(static) "Mutation.setEmailOnAnonymousCart"(parentResult, context) → {Promise.<Object>}

resolver for the setEmailOnAnonymousCart GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

An anonymous cart ID

token String

The token for accessing the anonymous cart

clientMutationId String <optional>

An optional string identifying the mutation call

email String

The email address to associate with this cart

context Object

an object containing the per-request state

Returns:

SetEmailOnAnonymousCartPayload

Type
Promise.<Object>

(static) "Mutation.setShippingAddressOnCart"(parentResult, context) → {Promise.<Object>}

resolver for the setShippingAddressOnCart GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
address Object

The shipping address

addressId String <optional>

If set, this will be saved as the Address._id. Otherwise an ID will be generated.

cartId String

The cart to set shipping address on

cartToken String <optional>

The token for the cart, required if it is an anonymous cart

clientMutationId String <optional>

An optional string identifying the mutation call

context Object

an object containing the per-request state

Returns:

SetShippingAddressOnCartPayload

Type
Promise.<Object>

(static) "Mutation.updateCartItemsQuantity"(parentResult, context) → {Promise.<Object>}

resolver for the updateCartItemsQuantity GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

The ID of the cart in which all of the items exist

items String

Array of items to update

Properties
Name Type Description
cartItemId Number

The cart item ID

quantity Object

The new quantity, which must be an integer of 0 or greater

token String

The token if the cart is an anonymous cart

clientMutationId String <optional>

An optional string identifying the mutation call

context Object

an object containing the per-request state

Returns:

UpdateCartItemsQuantityPayload

Type
Promise.<Object>

(static) "Mutation.updateFulfillmentOptionsForGroup"(parentResult, context) → {Promise.<Object>}

resolver for the updateFulfillmentOptionsForGroup GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args.input Object

an object of all mutation arguments that were sent by the client

Properties
Name Type Attributes Description
cartId String

The ID of the cart to update fulfillment options for

cartToken String <optional>

The token for the cart, required if it is an anonymous cart

fulfillmentGroupId String

The group to update fulfillment options for

clientMutationId String <optional>

An optional string identifying the mutation call

context Object

an object containing the per-request state

Returns:

UpdateFulfillmentOptionsForGroupPayload

Type
Promise.<Object>

(static) "Query.accountCartByAccountId"(parentResult, args, context) → {Promise.<Object>|undefined}

resolver for the accountCartByAccountId GraphQL mutation

Source:
Parameters:
Name Type Description
parentResult Object

unused

args Object

an object of all arguments that were sent by the client

Properties
Name Type Description
accountId String

The account for which to generate an account cart

shopId String

The shop that will own this cart

context Object

an object containing the per-request state

Returns:

A Cart object

Type
Promise.<Object> | undefined