1
1
# Copyright © Magento, Inc. All rights reserved.
2
2
# See COPYING.txt for license details.
3
3
4
+ type Query {
5
+ getAvailableShippingMethodsOnCart (input : AvailableShippingMethodsOnCartInput ): AvailableShippingMethodsOnCartOutput @doc (description :"Returns available shipping methods for cart by address/address_id" )
6
+ }
7
+
4
8
type Mutation {
5
9
createEmptyCart : String @resolver (class : " \\ Magento\\ QuoteGraphQl\\ Model\\ Resolver\\ Cart\\ CreateEmptyCart" ) @doc (description :"Creates empty shopping cart for guest or logged in user" )
6
10
applyCouponToCart (input : ApplyCouponToCartInput ): ApplyCouponToCartOutput @resolver (class : " \\ Magento\\ QuoteGraphQl\\ Model\\ Resolver\\ Coupon\\ ApplyCouponToCart" )
7
11
removeCouponFromCart (input : RemoveCouponFromCartInput ): RemoveCouponFromCartOutput @resolver (class : " \\ Magento\\ QuoteGraphQl\\ Model\\ Resolver\\ Coupon\\ RemoveCouponFromCart" )
12
+ setShippingAddressesOnCart (input : SetShippingAddressesOnCartInput ): SetShippingAddressesOnCartOutput
13
+ setBillingAddressOnCart (input : SetBillingAddressOnCartInput ): SetBillingAddressOnCartOutput
14
+ setShippingMethodsOnCart (input : SetShippingMethodsOnCartInput ): SetShippingMethodsOnCartOutput
15
+ }
16
+
17
+ input SetShippingAddressesOnCartInput {
18
+ cart_id : String !
19
+ customer_address_id : Int # Can be provided in one-page checkout and is required for multi-shipping checkout
20
+ address : CartAddressInput
21
+ cart_items : [CartItemQuantityInput ! ]
22
+ }
23
+
24
+ input CartItemQuantityInput {
25
+ cart_item_id : Int !
26
+ quantity : Float !
27
+ }
28
+
29
+ input SetBillingAddressOnCartInput {
30
+ cart_id : String !
31
+ customer_address_id : Int
32
+ address : CartAddressInput
33
+ # TODO: consider adding "Same as shipping" option
34
+ }
35
+
36
+ input CartAddressInput {
37
+ firstname : String !
38
+ lastname : String !
39
+ company : String
40
+ street : [String ! ]!
41
+ city : String !
42
+ region : String
43
+ postcode : String
44
+ country_code : String !
45
+ telephone : String !
46
+ save_in_address_book : Boolean !
47
+ }
48
+
49
+ input SetShippingMethodsOnCartInput {
50
+ shipping_methods : [ShippingMethodForAddressInput ! ]!
51
+ }
52
+
53
+ input ShippingMethodForAddressInput {
54
+ cart_address_id : String !
55
+ shipping_method_code : String !
56
+ }
57
+
58
+ type SetBillingAddressOnCartOutput {
59
+ cart : Cart !
60
+ }
61
+
62
+ type SetShippingAddressesOnCartOutput {
63
+ cart : Cart !
64
+ }
65
+
66
+ type SetShippingMethodsOnCartOutput {
67
+ cart : Cart !
68
+ }
69
+
70
+ # If no address is provided, the system get address assigned to a quote
71
+ # If there's no address at all - the system returns all shipping methods
72
+ type AvailableShippingMethodsOnCartInput {
73
+ cart_id : String !
74
+ customer_address_id : Int
75
+ address : CartAddressInput
76
+ }
77
+
78
+ type AvailableShippingMethodsOnCartOutput {
79
+ available_shipping_methods : [CheckoutShippingMethod ]
8
80
}
9
81
10
82
input ApplyCouponToCartInput {
@@ -18,12 +90,56 @@ type ApplyCouponToCartOutput {
18
90
19
91
type Cart {
20
92
applied_coupon : AppliedCoupon
93
+ addresses : [CartAddress ]!
21
94
}
22
95
23
96
type CartAddress {
97
+ firstname : String !
98
+ lastname : String !
99
+ company : String
100
+ street : [String ! ]!
101
+ city : String !
102
+ region : CartAddressRegion
103
+ postcode : String
104
+ country : CartAddressCountry !
105
+ telephone : String !
106
+ address_type : AdressTypeEnum !
107
+ selected_shipping_method : CheckoutShippingMethod
108
+ available_shipping_methods : [CheckoutShippingMethod ]!
109
+ items_weight : Float
110
+ customer_notes : String
111
+ cart_items : [CartItemQuantity ]
24
112
applied_coupon : AppliedCoupon
25
113
}
26
114
115
+ type CartItemQuantity {
116
+ cart_item_id : String !
117
+ quantity : Float !
118
+ }
119
+
120
+ type CartAddressRegion {
121
+ code : String
122
+ label : String
123
+ }
124
+
125
+ type CartAddressCountry {
126
+ code : String
127
+ label : String
128
+ }
129
+
130
+ type CheckoutShippingMethod {
131
+ code : String
132
+ label : String
133
+ free_shipping : Boolean !
134
+ error_message : String
135
+ # TODO: Add more complex structure for shipping rates
136
+ }
137
+
138
+ enum AdressTypeEnum {
139
+ SHIPPING
140
+ BILLING
141
+ }
142
+
27
143
type AppliedCoupon {
28
144
code : String !
29
145
}
0 commit comments