1 get:
2 operationId: GetShippingOptionsId
3 summary: Get a Shipping Option
4 description: >-
5 Retrieve a shipping option by its ID. You can expand the shipping option's
6 relations or select the fields that should be returned.
7 x-authenticated: true
8 parameters:
9 - name: id
10 in: path
11 description: The shipping option's ID.
12 required: true
13 schema:
14 type: string
15 - name: fields
16 in: query
17 description: >-
18 Comma-separated fields that should be included in the returned data.
19
20 if a field is prefixed with `+` it will be added to the default fields,
21 using `-` will remove it from the default fields.
22
23 without prefix it will replace the entire default fields.
24 required: false
25 schema:
26 type: string
27 title: fields
28 description: >-
29 Comma-separated fields that should be included in the returned data.
30 if a field is prefixed with `+` it will be added to the default
31 fields, using `-` will remove it from the default fields. without
32 prefix it will replace the entire default fields.
33 externalDocs:
34 url: '#select-fields-and-relations'
35 security:
36 - api_token: []
37 - cookie_auth: []
38 - jwt_token: []
39 x-codeSamples:
40 - lang: JavaScript
41 label: JS SDK
42 source:
43 $ref: ../code_samples/JavaScript/admin_shipping-options_{id}/get.js
44 - lang: Shell
45 label: cURL
46 source:
47 $ref: ../code_samples/Shell/admin_shipping-options_{id}/get.sh
48 tags:
49 - Shipping Options
50 responses:
51 '200':
52 description: OK
53 content:
54 application/json:
55 schema:
56 $ref: ../components/schemas/AdminShippingOptionResponse.yaml
57 '400':
58 $ref: ../components/responses/400_error.yaml
59 '401':
60 $ref: ../components/responses/unauthorized.yaml
61 '404':
62 $ref: ../components/responses/not_found_error.yaml
63 '409':
64 $ref: ../components/responses/invalid_state_error.yaml
65 '422':
66 $ref: ../components/responses/invalid_request_error.yaml
67 '500':
68 $ref: ../components/responses/500_error.yaml
69 post:
70 operationId: PostShippingOptionsId
71 summary: Update a Shipping Option
72 description: >
73 Update a shipping option's details.
74
75
76 When you provide the `prices` array, it replaces the shipping option's
77 existing flat-rate prices:
78
79
80 - A price with a matching `id` is updated.
81
82 - A price without an `id` is created
83
84 - Any existing price whose `id` isn't included in the array is deleted.
85
86
87 The `rules` you provide for a price similarly replace that price's existing
88 rules, so omit a rule to remove it.
89
90
91 Omitting the `prices` property entirely leaves the existing prices
92 unchanged, whereas setting `price_type` to `calculated` removes all
93 flat-rate prices.
94 x-authenticated: true
95 parameters:
96 - name: id
97 in: path
98 description: The shipping option's ID.
99 required: true
100 schema:
101 type: string
102 - name: fields
103 in: query
104 description: >-
105 Comma-separated fields that should be included in the returned data. If
106 a field is prefixed with `+` it will be added to the default fields,
107 using `-` will remove it from the default fields. Without prefix it will
108 replace the entire default fields.
109 required: false
110 schema:
111 type: string
112 title: fields
113 description: >-
114 Comma-separated fields that should be included in the returned data.
115 If a field is prefixed with `+` it will be added to the default
116 fields, using `-` will remove it from the default fields. Without
117 prefix it will replace the entire default fields.
118 externalDocs:
119 url: '#select-fields-and-relations'
120 security:
121 - api_token: []
122 - cookie_auth: []
123 - jwt_token: []
124 requestBody:
125 content:
126 application/json:
127 schema:
128 $ref: ../components/schemas/AdminUpdateShippingOption.yaml
129 x-codeSamples:
130 - lang: JavaScript
131 label: JS SDK
132 source:
133 $ref: ../code_samples/JavaScript/admin_shipping-options_{id}/post.js
134 - lang: Shell
135 label: cURL
136 source:
137 $ref: ../code_samples/Shell/admin_shipping-options_{id}/post.sh
138 tags:
139 - Shipping Options
140 responses:
141 '200':
142 description: OK
143 content:
144 application/json:
145 schema:
146 $ref: ../components/schemas/AdminShippingOptionResponse.yaml
147 '400':
148 $ref: ../components/responses/400_error.yaml
149 '401':
150 $ref: ../components/responses/unauthorized.yaml
151 '404':
152 $ref: ../components/responses/not_found_error.yaml
153 '409':
154 $ref: ../components/responses/invalid_state_error.yaml
155 '422':
156 $ref: ../components/responses/invalid_request_error.yaml
157 '500':
158 $ref: ../components/responses/500_error.yaml
159 x-workflow: updateShippingOptionsWorkflow
160 x-events:
161 - name: shipping-option.updated
162 payload: |-
163 ```ts
164 {
165 id, // The ID of the shipping option
166 }
167 ```
168 description: Emitted when shipping options are updated.
169 deprecated: false
170 since: 2.12.4
171 delete:
172 operationId: DeleteShippingOptionsId
173 summary: Delete a Shipping Option
174 description: Delete a shipping option.
175 x-authenticated: true
176 parameters:
177 - name: id
178 in: path
179 description: The shipping option's ID.
180 required: true
181 schema:
182 type: string
183 security:
184 - api_token: []
185 - cookie_auth: []
186 - jwt_token: []
187 x-codeSamples:
188 - lang: JavaScript
189 label: JS SDK
190 source:
191 $ref: ../code_samples/JavaScript/admin_shipping-options_{id}/delete.js
192 - lang: Shell
193 label: cURL
194 source:
195 $ref: ../code_samples/Shell/admin_shipping-options_{id}/delete.sh
196 tags:
197 - Shipping Options
198 responses:
199 '200':
200 description: OK
201 content:
202 application/json:
203 schema:
204 $ref: ../components/schemas/AdminShippingOptionDeleteResponse.yaml
205 '400':
206 $ref: ../components/responses/400_error.yaml
207 '401':
208 $ref: ../components/responses/unauthorized.yaml
209 '404':
210 $ref: ../components/responses/not_found_error.yaml
211 '409':
212 $ref: ../components/responses/invalid_state_error.yaml
213 '422':
214 $ref: ../components/responses/invalid_request_error.yaml
215 '500':
216 $ref: ../components/responses/500_error.yaml
217 x-workflow: deleteShippingOptionsWorkflow
218 x-events:
219 - name: shipping-option.deleted
220 payload: |-
221 ```ts
222 {
223 id, // The ID of the shipping option
224 }
225 ```
226 description: Emitted when shipping options are deleted.
227 deprecated: false
228 since: 2.12.4