mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 22:16:58 +00:00
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import cartFragment from '../fragments/cart';
|
|
|
|
export const addToCartMutation = /* GraphQL */ `
|
|
mutation addToCart(
|
|
$cartId: ID!
|
|
$lines: [CartLineInput!]!
|
|
$country: CountryCode
|
|
$language: LanguageCode
|
|
) @inContext($country: String, $language: String) {
|
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
cart {
|
|
...cart
|
|
}
|
|
}
|
|
}
|
|
${cartFragment}
|
|
`;
|
|
|
|
export const createCartMutation = /* GraphQL */ `
|
|
mutation createCart(
|
|
$lineItems: [CartLineInput!],
|
|
$country: CountryCode,
|
|
$language: LanguageCode
|
|
) @inContext($country: String, $language: String) {
|
|
cartCreate(input: { lines: $lineItems }) {
|
|
cart {
|
|
...cart
|
|
}
|
|
}
|
|
}
|
|
${cartFragment}
|
|
`;
|
|
|
|
export const editCartItemsMutation = /* GraphQL */ `
|
|
mutation editCartItems($cartId: ID!, $lines: [CartLineUpdateInput!]!, $country: CountryCode, $language: LanguageCode)
|
|
@inContext($country: String, $language: String) {
|
|
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
cart {
|
|
...cart
|
|
}
|
|
}
|
|
}
|
|
${cartFragment}
|
|
`;
|
|
|
|
export const removeFromCartMutation = /* GraphQL */ `
|
|
mutation removeFromCart($cartId: ID!, $lineIds: [ID!]!, $country: CountryCode, $language: LanguageCode)
|
|
@inContext($country: String, $language: String) {
|
|
cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
|
|
cart {
|
|
...cart
|
|
}
|
|
}
|
|
}
|
|
${cartFragment}
|
|
`;
|