AddProductToCart.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { gql, TypedDocumentNode } from "@apollo/client";
  2. import { AddToCartData } from "@/types/cart/type";
  3. export const CREATE_ADD_PRODUCT_IN_CART: TypedDocumentNode<AddToCartData> = gql`
  4. mutation createAddProductInCart(
  5. $cartId: Int
  6. $productId: Int!
  7. $quantity: Int!
  8. $variantId: Int
  9. ) {
  10. createAddProductInCart(
  11. input: {
  12. cartId: $cartId
  13. productId: $productId
  14. quantity: $quantity
  15. variantId: $variantId
  16. }
  17. ) {
  18. addProductInCart {
  19. id
  20. cartToken
  21. sessionToken
  22. appliedTaxes
  23. itemsQty
  24. isGuest
  25. itemsCount
  26. items {
  27. edges {
  28. node {
  29. id
  30. cartId
  31. productId
  32. name
  33. price
  34. baseImage
  35. sku
  36. quantity
  37. type
  38. productUrlKey
  39. canChangeQty
  40. }
  41. }
  42. }
  43. subtotal
  44. subTotalInclTax
  45. discountAmount
  46. taxAmount
  47. taxTotal
  48. shippingAmount
  49. shippingAmountInclTax
  50. grandTotal
  51. formattedSubtotal
  52. formattedSubTotalInclTax
  53. formattedDiscountAmount
  54. formattedTaxAmount
  55. formattedTaxTotal
  56. formattedShippingAmount
  57. formattedShippingAmountInclTax
  58. formattedGrandTotal
  59. couponCode
  60. selectedShippingRate
  61. selectedShippingRateTitle
  62. paymentMethod
  63. paymentMethodTitle
  64. haveStockableItems
  65. billingAddress
  66. shippingAddress
  67. success
  68. message
  69. }
  70. }
  71. }
  72. `;