Choose the shipping method of a cart's order
const url = 'https://acme.mykreezalid.com/front_api/v1/carts/k3v9q2m8x1c7z5b4n6t0p2r8s1d3f7/orders/4242/shipping-method';const options = { method: 'PATCH', headers: {'Content-Type': 'application/json'}, body: '{"shipping_method_id":12}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://acme.mykreezalid.com/front_api/v1/carts/k3v9q2m8x1c7z5b4n6t0p2r8s1d3f7/orders/4242/shipping-method \ --header 'Content-Type: application/json' \ --data '{ "shipping_method_id": 12 }'Sets the shipping method of one order of the cart and updates its shipping price. If the method is not available for that order, the first available method is selected instead and the call still succeeds: read the cart again to see which method was kept. When a custom shipping amount was forced on the order, any shipping method is accepted and only its name changes; the forced amount stays. Works without a token. When you send a token and the cart is a guest cart, the cart (and the guest’s other carts and orders) is attached to the signed-in member first.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The cart’s url_key, returned when the cart is created.
Example
k3v9q2m8x1c7z5b4n6t0p2r8s1d3f7Id of one of the cart’s orders (orders[].id in GET /carts/{url_key}).
Example
4242Request Bodyrequired
Section titled “Request Bodyrequired”object
Id of the shipping method, as returned in id by GET /carts/{url_key}/orders/{order_id}/available-shipping-methods for options of type ShippingRate or CustomShippingRate.
Example
12Responses
Section titled “Responses”The shipping method was updated.
Outcome of a cart change: status is success when it was applied, failed or error when it was not.
object
Outcome body of the cart endpoints that report status and message.
Human-readable outcome.
Example
{ "status": "success", "message": "Listing updated successfully"}The order could not be updated (status is failed).
Outcome of a cart change: status is success when it was applied, failed or error when it was not.
object
Outcome body of the cart endpoints that report status and message.
Human-readable outcome.
Example
{ "status": "success", "message": "Listing updated successfully"}No cart has this key, the order is not in this cart, or no shipping method has this id (status is failed).
Outcome of a cart change: status is success when it was applied, failed or error when it was not.
object
Outcome body of the cart endpoints that report status and message.
Human-readable outcome.
Example
{ "status": "success", "message": "Listing updated successfully"}