customer.tpl 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. type Query {
  2. # Returns a Customer resource by ID.
  3. customer(id: ID!): Customer
  4. }
  5. type Mutation {
  6. customerCreate(input: CustomerInput!): CustomerCreatePayload
  7. }
  8. input CustomerInput {
  9. # The addresses for a customer.
  10. addresses: [MailingAddressInput!]
  11. # The unique email address of the customer.
  12. email: String
  13. # The customer's first name.
  14. firstName: String
  15. # The ID of the customer to update.
  16. id: ID
  17. # The customer's last name.
  18. lastName: String
  19. # The customer's locale.
  20. locale: String
  21. # Additional metafields to associate to the customer.
  22. metafields: [MetafieldInput!]
  23. # A note about the customer.
  24. note: String
  25. # The unique phone number for the customer.
  26. phone: String
  27. # The private metafields to associate with the customer.
  28. privateMetafields: [PrivateMetafieldInput!]
  29. # A list of tags to associate with the customer. Can be an array or a comma-separated list. Example values: ["tag1", "tag2", "tag3"], "tag1, tag2, tag3"
  30. #
  31. # Updating tags overwrites any existing tags that were previously added to the customer. To add new tags without overwriting
  32. # existing tags, use the tagsAdd mutation.
  33. tags: [String!]
  34. }
  35. # Return type for customerCreate mutation.
  36. type CustomerCreatePayload {
  37. # The created customer.
  38. customer: Customer
  39. # The list of errors that occurred from executing the mutation.
  40. userErrors: [UserError!]!
  41. }
  42. # Represents information about a customer of the shop, such as the customer's contact details, their order
  43. # history, and whether they've agreed to receive marketing material by email.
  44. #
  45. # Caution: Only use this data if it's required for your app's functionality.
  46. # Shopify will restrict access to scopes for apps that don't have a legitimate use for the associated data.
  47. type Customer
  48. implements CommentEventSubject&HasEvents&HasMetafieldDefinitions&HasMetafields&LegacyInteroperability&Node
  49. @key(fields: "id") {
  50. # A list of addresses associated with the customer.
  51. addresses(first: Int): [MailingAddress!]!
  52. # The total amount that the customer has spent on orders in their lifetime.
  53. amountSpent: MoneyV2!
  54. # The average amount that the customer spent per order.
  55. averageOrderAmountV2: MoneyV2
  56. # Whether the merchant can delete the customer from their store.
  57. #
  58. # A customer can be deleted from a store only if they have not yet made an order. After a customer makes an
  59. # order, they can't be deleted from a store.
  60. canDelete: Boolean!
  61. # A list of the customer's company contact profiles.
  62. companyContactProfiles: [CompanyContact!]!
  63. # The date and time when the customer was added to the store.
  64. createdAt: DateTime!
  65. # The default address associated with the customer.
  66. defaultAddress: MailingAddress
  67. # The full name of the customer, based on the values for first_name and last_name. If the first_name and
  68. # last_name are not available, then this falls back to the customer's email address, and if that is not available, the customer's phone number.
  69. displayName: String!
  70. # The customer's email address.
  71. email: String
  72. # The current email marketing state for the customer.
  73. # If the customer doesn't have an email address, then this property is `null`.
  74. emailMarketingConsent: CustomerEmailMarketingConsentState
  75. # A list of events associated with the customer.
  76. events(
  77. first: Int
  78. after: String
  79. last: Int
  80. before: String
  81. reverse: Boolean = false
  82. sortKey: EventSortKeys = ID
  83. query: String
  84. ): EventConnection!
  85. # The customer's first name.
  86. firstName: String
  87. # Whether the timeline subject has a timeline comment. If true, then a timeline comment exists.
  88. hasTimelineComment: Boolean!
  89. # A globally-unique identifier.
  90. id: ID!
  91. # The image associated with the customer.
  92. image: Image!
  93. # The customer's last name.
  94. lastName: String
  95. # The customer's last order.
  96. lastOrder: Order
  97. # The ID of the corresponding resource in the REST Admin API.
  98. legacyResourceId: UnsignedInt64!
  99. # The amount of time since the customer was first added to the store.
  100. #
  101. # Example: 'about 12 years'.
  102. lifetimeDuration: String!
  103. # The customer's locale.
  104. locale: String!
  105. # The market that includes the customer’s default address.
  106. market: Market
  107. # Returns a metafield by namespace and key that belongs to the resource.
  108. metafield(namespace: String!key: String!): Metafield
  109. # List of metafield definitions.
  110. metafieldDefinitions(
  111. namespace: String
  112. pinnedStatus: MetafieldDefinitionPinnedStatus = ANY
  113. first: Int
  114. after: String
  115. last: Int
  116. before: String
  117. reverse: Boolean = false
  118. sortKey: MetafieldDefinitionSortKeys = ID
  119. query: String
  120. ): MetafieldDefinitionConnection!
  121. # List of metafields that belong to the resource.
  122. metafields(
  123. namespace: String
  124. first: Int
  125. after: String
  126. last: Int
  127. before: String
  128. reverse: Boolean = false
  129. ): MetafieldConnection!
  130. # A unique identifier for the customer that's used with Multipass login.
  131. multipassIdentifier: String
  132. # A note about the customer.
  133. note: String
  134. # The number of orders that the customer has made at the store in their lifetime.
  135. numberOfOrders: UnsignedInt64!
  136. # A list of the customer's orders.
  137. orders(
  138. first: Int
  139. after: String
  140. last: Int
  141. before: String
  142. reverse: Boolean = false
  143. sortKey: OrderSortKeys = ID
  144. query: String
  145. ): OrderConnection!
  146. # A list of the customer's payment methods.
  147. paymentMethods(
  148. showRevoked: Boolean = false
  149. first: Int
  150. after: String
  151. last: Int
  152. before: String
  153. reverse: Boolean = false
  154. ): CustomerPaymentMethodConnection!
  155. # The customer's phone number.
  156. phone: String
  157. # Returns a private metafield by namespace and key that belongs to the resource.
  158. privateMetafield(namespace: String!key: String!): PrivateMetafield
  159. # List of private metafields that belong to the resource.
  160. privateMetafields(
  161. namespace: String
  162. first: Int
  163. after: String
  164. last: Int
  165. before: String
  166. reverse: Boolean = false
  167. ): PrivateMetafieldConnection!
  168. # Possible subscriber states of a customer defined by their subscription contracts.
  169. productSubscriberStatus: CustomerProductSubscriberStatus!
  170. # The current SMS marketing state for the customer's phone number.
  171. #
  172. # If the customer does not have a phone number, then this property is null.
  173. smsMarketingConsent: CustomerSmsMarketingConsentState
  174. # The state of the customer's account with the shop.
  175. state: CustomerState!
  176. # The statistics for a given customer.
  177. statistics: CustomerStatistics!
  178. # A list of the customer's subscription contracts.
  179. subscriptionContracts(
  180. first: Int
  181. after: String
  182. last: Int
  183. before: String
  184. reverse: Boolean = false
  185. ): SubscriptionContractConnection!
  186. # A comma separated list of tags that have been added to the customer.
  187. tags: [String!]!
  188. # Whether the customer is exempt from being charged taxes on their orders.
  189. taxExempt: Boolean!
  190. # The list of tax exemptions applied to the customer.
  191. taxExemptions: [TaxExemption!]!
  192. # The URL to unsubscribe the customer from the mailing list.
  193. unsubscribeUrl: URL!
  194. # The date and time when the customer was last updated.
  195. updatedAt: DateTime!
  196. # Whether the email address is formatted correctly.
  197. # Returns true when the email is formatted correctly and
  198. # belongs to an existing domain. This doesn't guarantee that
  199. # the email address actually exists.
  200. validEmailAddress: Boolean!
  201. # Whether the customer has verified their email address. Defaults to true if the customer is created through the Shopify admin or API.
  202. verifiedEmail: Boolean!
  203. }
  204. extend type App @key(fields: "id") {
  205. id: ID! @external
  206. }
  207. extend type Order @key(fields: "id") {
  208. id: ID! @external
  209. }
  210. extend type DraftOrder @key(fields: "id") {
  211. id: ID! @external
  212. }
  213. extend type ProductVariant @key(fields: "id") {
  214. id: ID! @external
  215. }
  216. extend type Product @key(fields: "id") {
  217. id: ID! @external
  218. }
  219. extend type Collection @key(fields: "id") {
  220. id: ID! @external
  221. }
  222. extend type Market @key(fields: "id") {
  223. id: ID! @external
  224. }
  225. extend type InventoryLevel @key(fields: "id") {
  226. id: ID! @external
  227. }
  228. extend type FulfillmentService @key(fields: "id") {
  229. id: ID! @external
  230. }
  231. extend type MarketWebPresence @key(fields: "id") {
  232. id: ID! @external
  233. }