Skip to content

Choose the shipping method of a cart's order

PATCH
/carts/{url_key}/orders/{order_id}/shipping-method
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.

url_key
required
string

The cart’s url_key, returned when the cart is created.

Example

k3v9q2m8x1c7z5b4n6t0p2r8s1d3f7
order_id
required
integer

Id of one of the cart’s orders (orders[].id in GET /carts/{url_key}).

Example

4242
Media typeapplication/json
object
shipping_method_id
required

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.

integer

Example

12

The shipping method was updated.

Media typeapplication/json

Outcome of a cart change: status is success when it was applied, failed or error when it was not.

object
status

Outcome body of the cart endpoints that report status and message.

string
message

Human-readable outcome.

string

Example

{
"status": "success",
"message": "Listing updated successfully"
}

The order could not be updated (status is failed).

Media typeapplication/json

Outcome of a cart change: status is success when it was applied, failed or error when it was not.

object
status

Outcome body of the cart endpoints that report status and message.

string
message

Human-readable outcome.

string

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).

Media typeapplication/json

Outcome of a cart change: status is success when it was applied, failed or error when it was not.

object
status

Outcome body of the cart endpoints that report status and message.

string
message

Human-readable outcome.

string

Example

{
"status": "success",
"message": "Listing updated successfully"
}