Wiki source code of Shipping Types
Last modified by Shop Team on 2023/02/13 22:56
Hide last authors
author | version | line-number | content |
---|---|---|---|
5.1 | 1 | In our terminology, a shipping type defines the way Spreadshirt delivers an ordered item to a customer. Depending on whether the customer ordered a real item, like a t-shirt, or a virtual item, like a gift certificate, we either need to ship the item using a standard carrier, like Deutsche Post or UPS, or we can send it using e-mail. | |
2 | |||
4.1 | 3 | = List of available shipping types = | |
3.1 | 4 | ||
4.1 | 5 | (% class="wrapped" %) | |
3.1 | 6 | |=((( | |
7 | Method | ||
8 | )))|=((( | ||
9 | URL | ||
10 | )))|=((( | ||
11 | Example | ||
12 | ))) | ||
13 | |((( | ||
14 | GET | ||
15 | )))|((( | ||
16 | /api/v1/shops/<shopId>/shippingTypes | ||
17 | )))|((( | ||
18 | [[https:~~/~~/api.spreadshirt.net/api/v1/shops/100488332/shippingTypes?mediaType=json>>url:https://api.spreadshirt.net/api/v1/shops/100488332/shippingTypes?mediaType=json||shape="rect"]] | ||
19 | ))) | ||
20 | |||
21 | \\ | ||
22 | |||
23 | This resource will list all available shipping types for the given shop. | ||
24 | |||
25 | \\ | ||
26 | |||
9.1 | 27 | {{code language="js" title="Example Payload"}} | |
3.1 | 28 | { | |
29 | "offset":0, | ||
30 | "limit":50, | ||
31 | "count":3, | ||
32 | "sortField":"default", | ||
33 | "sortOrder":"default", | ||
34 | "shippingTypes":[ | ||
35 | { | ||
36 | "href":"https://api.spreadshirt.net/api/v1/shops/100488332/shippingTypes/1", | ||
37 | "id":"1" | ||
38 | }, | ||
39 | { | ||
40 | "href":"https://api.spreadshirt.net/api/v1/shops/100488332/shippingTypes/12", | ||
41 | "id":"12" | ||
42 | }, | ||
43 | { | ||
44 | "href":"https://api.spreadshirt.net/api/v1/shops/100488332/shippingTypes/18", | ||
45 | "id":"18" | ||
46 | } | ||
47 | ], | ||
48 | "href":"https://api.spreadshirt.net/api/v1/shops/100488332/shippingTypes" | ||
49 | } | ||
50 | {{/code}} | ||
51 | |||
52 | (% class="auto-cursor-target" %) | ||
4.1 | 53 | \\ | |
3.1 | 54 | ||
55 | \\ | ||
56 | |||
4.1 | 57 | = Detailed information about a shipping type = | |
58 | |||
59 | (% class="wrapped" %) | ||
3.1 | 60 | |=((( | |
61 | Method | ||
62 | )))|=((( | ||
63 | URL | ||
64 | )))|=((( | ||
65 | Example | ||
66 | ))) | ||
67 | |((( | ||
68 | GET | ||
69 | )))|((( | ||
70 | /api/v1/shops/<shopId>/shippingTypes/<shippingTypeId> | ||
71 | )))|((( | ||
72 | [[https:~~/~~/api.spreadshirt.net/api/v1/shops/100488332/shippingTypes/1?mediaType=json>>url:https://api.spreadshirt.net/api/v1/shops/100488332/shippingTypes/1?mediaType=json||shape="rect"]] | ||
73 | ))) | ||
74 | |||
75 | \\ | ||
76 | |||
5.1 | 77 | A shipping type has right now the following characteristics: | |
3.1 | 78 | ||
5.1 | 79 | * Each shipping type has a **name** and a **description**, that can be used for displaying shipping type information in a client application. For shipping types that denote a shipping of a real item with a standard carrier, there are the available **shipping countries** and the **shipping regions** with the **shipping costs** for different order values defined. | |
80 | * **Shipping Country:** A shipping country is a country that Spreadshirt ships items to using the specified standard carries, like UPS. A shipping country has a **name** that can be used for displaying country information in a client application. It also **links to a specific shipping region** that contains the actual shipping costs for different order values. | ||
81 | * **Shipping Region:** A shipping region contains the **shipping costs** for different order value ranges for a set of shipping countries, like France or United Kingdom if your country of delivery is Germany. Each **order value range** defines a **from *order value (lower bound), like 0.00 €, and might define a *to** order value (upper bound), like 24.89 € or unbound (undefined). Depending on the order value of the order, the shipping costs of the matching order value range apply. | ||
82 | |||
3.1 | 83 | \\ | |
84 | |||
5.1 | 85 | [[image:attach:shipping-type-model.png]] | |
86 | |||
87 | \\ | ||
88 | |||
89 | **Example** | ||
90 | |||
9.1 | 91 | {{code language="js" title="Example Payload"}} | |
3.1 | 92 | { | |
93 | "href":"https://api.spreadshirt.net/api/v1/shops/100488332/shippingTypes/1", | ||
94 | "id":"1", | ||
95 | "lifeCycleState":"ACTIVATED", | ||
96 | "weight":1.0, | ||
97 | "isExpress":false, | ||
98 | "phoneNumberRequired":false, | ||
99 | "supportsPackstation":true, | ||
100 | "name":"Standard", | ||
101 | "description":"Tracking and delivery date not guaranteed. May be mailed via envelope.", | ||
102 | "trackingLink":{ | ||
103 | "href":"http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc={trackingCode}&rfn=&extendedSearch=true" | ||
104 | }, | ||
105 | "shippingProviderId":"@home", | ||
106 | "shippingAccountId":"@HOME", | ||
107 | "shippingCountries":[ | ||
108 | { | ||
109 | "id":"60", | ||
110 | "created":"1970-01-02T23:00:00.000+0000", | ||
111 | "modified":"2019-02-19T09:18:47.000+0000", | ||
112 | "lifeCycleState":"ACTIVATED", | ||
113 | "name":"Bahamas", | ||
114 | "isoCode":"BS", | ||
115 | "shippingRegion":{ | ||
6.1 | 116 | "id":"1" | |
3.1 | 117 | }, | |
118 | "shippingSupported":true, | ||
119 | "externalFulfillmentSupported":true, | ||
120 | "shippingStates":[ | ||
121 | |||
122 | ], | ||
123 | "customs":true | ||
124 | }, | ||
125 | { | ||
126 | "id":"279", | ||
127 | "created":"1970-01-02T23:00:00.000+0000", | ||
128 | "modified":"2019-02-19T09:18:49.000+0000", | ||
129 | "lifeCycleState":"ACTIVATED", | ||
130 | "name":"British Virgin Islands", | ||
131 | "isoCode":"VG", | ||
132 | "shippingRegion":{ | ||
6.1 | 133 | "id":"1" | |
3.1 | 134 | }, | |
135 | "shippingSupported":true, | ||
136 | "externalFulfillmentSupported":true, | ||
137 | "shippingStates":[ | ||
138 | |||
139 | ], | ||
140 | "customs":true | ||
141 | }, | ||
142 | { | ||
143 | "id":"286", | ||
144 | "created":"1970-01-02T23:00:00.000+0000", | ||
145 | "modified":"2019-02-19T09:18:49.000+0000", | ||
146 | "lifeCycleState":"ACTIVATED", | ||
147 | "name":"Cayman Islands", | ||
148 | "isoCode":"KY", | ||
149 | "shippingRegion":{ | ||
6.1 | 150 | "id":"2" | |
3.1 | 151 | }, | |
152 | "shippingSupported":true, | ||
153 | "externalFulfillmentSupported":true, | ||
154 | "shippingStates":[ | ||
155 | |||
156 | ], | ||
157 | "customs":true | ||
158 | }, | ||
159 | ], | ||
160 | "shippingRegions":[ | ||
161 | { | ||
162 | "id":"1", | ||
163 | "shippingCosts":[ | ||
164 | { | ||
165 | "orderValueRange":{ | ||
166 | "from":0.00, | ||
167 | "to":0.01, | ||
168 | "currency":{ | ||
169 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
170 | "id":"1" | ||
171 | } | ||
172 | }, | ||
173 | "cost":{ | ||
174 | "vatExcluded":0.00, | ||
175 | "vatIncluded":0.00, | ||
176 | "vat":19.00, | ||
177 | "currency":{ | ||
178 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
179 | "id":"1" | ||
180 | } | ||
181 | }, | ||
182 | "vatGroupId":"1" | ||
183 | }, | ||
184 | { | ||
185 | "orderValueRange":{ | ||
186 | "from":0.01, | ||
187 | "to":24.99, | ||
188 | "currency":{ | ||
189 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
190 | "id":"1" | ||
191 | } | ||
192 | }, | ||
193 | "cost":{ | ||
194 | "vatExcluded":3.35, | ||
195 | "vatIncluded":3.99, | ||
196 | "vat":19.00, | ||
197 | "currency":{ | ||
198 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
199 | "id":"1" | ||
200 | } | ||
201 | }, | ||
202 | "vatGroupId":"1" | ||
203 | }, | ||
204 | { | ||
205 | "orderValueRange":{ | ||
206 | "from":24.99, | ||
207 | "to":59.99, | ||
208 | "currency":{ | ||
209 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
210 | "id":"1" | ||
211 | } | ||
212 | }, | ||
213 | "cost":{ | ||
214 | "vatExcluded":4.19, | ||
215 | "vatIncluded":4.99, | ||
216 | "vat":19.00, | ||
217 | "currency":{ | ||
218 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
219 | "id":"1" | ||
220 | } | ||
221 | }, | ||
222 | "vatGroupId":"1" | ||
223 | }, | ||
224 | { | ||
225 | "orderValueRange":{ | ||
226 | "from":59.99, | ||
227 | "currency":{ | ||
228 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
229 | "id":"1" | ||
230 | } | ||
231 | }, | ||
232 | "cost":{ | ||
233 | "vatExcluded":5.87, | ||
234 | "vatIncluded":6.99, | ||
235 | "vat":19.00, | ||
236 | "currency":{ | ||
237 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
238 | "id":"1" | ||
239 | } | ||
240 | }, | ||
241 | "vatGroupId":"1" | ||
242 | } | ||
243 | ] | ||
244 | }, | ||
245 | { | ||
246 | "id":"2", | ||
247 | "shippingCosts":[ | ||
248 | { | ||
249 | "orderValueRange":{ | ||
250 | "from":0.00, | ||
251 | "to":0.01, | ||
252 | "currency":{ | ||
253 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
254 | "id":"1" | ||
255 | } | ||
256 | }, | ||
257 | "cost":{ | ||
258 | "vatExcluded":0.00, | ||
259 | "vatIncluded":0.00, | ||
260 | "vat":19.00, | ||
261 | "currency":{ | ||
262 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
263 | "id":"1" | ||
264 | } | ||
265 | }, | ||
266 | "vatGroupId":"1" | ||
267 | }, | ||
268 | { | ||
269 | "orderValueRange":{ | ||
270 | "from":0.01, | ||
271 | "to":24.99, | ||
272 | "currency":{ | ||
273 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
274 | "id":"1" | ||
275 | } | ||
276 | }, | ||
277 | "cost":{ | ||
278 | "vatExcluded":3.35, | ||
279 | "vatIncluded":3.99, | ||
280 | "vat":19.00, | ||
281 | "currency":{ | ||
282 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
283 | "id":"1" | ||
284 | } | ||
285 | }, | ||
286 | "vatGroupId":"1" | ||
287 | }, | ||
288 | { | ||
289 | "orderValueRange":{ | ||
290 | "from":24.99, | ||
291 | "to":59.99, | ||
292 | "currency":{ | ||
293 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
294 | "id":"1" | ||
295 | } | ||
296 | }, | ||
297 | "cost":{ | ||
298 | "vatExcluded":5.03, | ||
299 | "vatIncluded":5.99, | ||
300 | "vat":19.00, | ||
301 | "currency":{ | ||
302 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
303 | "id":"1" | ||
304 | } | ||
305 | }, | ||
306 | "vatGroupId":"1" | ||
307 | }, | ||
308 | { | ||
309 | "orderValueRange":{ | ||
310 | "from":59.99, | ||
311 | "currency":{ | ||
312 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
313 | "id":"1" | ||
314 | } | ||
315 | }, | ||
316 | "cost":{ | ||
317 | "vatExcluded":6.71, | ||
318 | "vatIncluded":7.99, | ||
319 | "vat":19.00, | ||
320 | "currency":{ | ||
321 | "href":"https://api.spreadshirt.net/api/v1/currencies/1", | ||
322 | "id":"1" | ||
323 | } | ||
324 | }, | ||
325 | "vatGroupId":"1" | ||
326 | } | ||
327 | ] | ||
328 | }, | ||
329 | ] | ||
330 | } | ||
331 | {{/code}} | ||
332 | |||
333 | (% class="auto-cursor-target" %) | ||
334 | \\ | ||
335 | |||
5.1 | 336 | == (% style="color: rgb(34,34,34);" %)Determining Shipping Costs(%%) == | |
337 | |||
11.1 | 338 | Keep in mind that for an existing basket, the [[basket resource>>doc:API.Spreadshirt Public Shop API Documentation.API REST Resources.Baskets.WebHome]] already contains the assumed shipping costs. If you want to display shipping costs beforehand, it is possible to evaluate the ruleset shown above as follows: | |
10.1 | 339 | The **order value for the shipping cost** calculation is always calculated based on a sellable's price and a sellable's product type. Each **product type has a shipping factor** between 0 and 1 (0-100%) that defines to which part the sellable price is used to calculate the order value. 0 means it is not used and 1 means the full sellable price is used for order value calculation. With the calculated order value, we now only need to find the right shipping region for the country we want to ship to and identify the shipping costs by finding the matching order value range for the shipping region. | |
5.1 | 340 | ||
341 | **Example** | ||
342 | |||
10.1 | 343 | Let’s assume we have an order with **2 x** Bud Spencer t-shirts (sellables at 12.90 € each) that we want to ship to Germany with the standard shipping type, which means we use **shipping type 1**, **shipping country 148** and **shipping region 1**. The shipping factor is 1 for that product type. Based on that data the order value calculation is as follows: | |
5.1 | 344 | ||
345 | {{noformat}} | ||
10.1 | 346 | 2 (quantity) x 1.0 (shipping factor) x 12.90 € (sellable price) | |
5.1 | 347 | --------------------------------------------------------------------- | |
348 | = 25.80 € | ||
349 | |||
350 | {{/noformat}} | ||
351 | |||
10.1 | 352 | Using the hypothetical shipping cost order value ranges defined for shipping region 1, | |
5.1 | 353 | ||
354 | {{noformat}} | ||
355 | 0.00 € - 24.89 € -> 2.90 € | ||
356 | 24.89 € - 59.99 € -> 3.90 € | ||
357 | 59.99 € - 500.00 € -> 0.00 € | ||
358 | 500.00 € - -> 0.00 € | ||
359 | |||
360 | {{/noformat}} | ||
361 | |||
362 | the shipping costs for the basket in our example are **3.90 €**. | ||
363 | |||
3.1 | 364 | \\ | |
5.1 | 365 | ||
366 | \\ |