Update a shipping rate
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/shipping-zones/1/rates/1';const options = { method: 'PUT', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"delivery_type":"STANDARD","display_name":"Giao tiêu chuẩn","rate_type":"FIXED","amount":25000,"condition_type":"NONE","min_value":1,"max_value":1,"estimated_days_min":1,"estimated_days_max":1,"carrier_code":"allingo","carrier_service_ids":["example"],"price_adjustment":-5000,"is_active":true,"sort_order":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://apibase.ecomweb.app/api/v1/stores/example/shipping-zones/1/rates/1 \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "delivery_type": "STANDARD", "display_name": "Giao tiêu chuẩn", "rate_type": "FIXED", "amount": 25000, "condition_type": "NONE", "min_value": 1, "max_value": 1, "estimated_days_min": 1, "estimated_days_max": 1, "carrier_code": "allingo", "carrier_service_ids": [ "example" ], "price_adjustment": -5000, "is_active": true, "sort_order": 1 }'Updates the fields you send. Switching a rate to CARRIER_QUOTE applies the same rules as creating one; switching a carrier rate back to FIXED needs an amount and clears the carrier fields. The zone in the path is not checked against the rate, which is looked up by its own ID.
Required scopes: write:shippings
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The shipping rate ID.
The ID of the shipping zone the rate belongs to.
The store’s ref, as returned by GET /stores.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Kind of delivery.
Name shown to the shopper at checkout.
Example
Giao tiêu chuẩnZero means free
Example
25000What min_value and max_value are measured on: the order value or the weight in grams. Defaults to NONE, which always matches.
Lowest order value or weight, in grams, the rate applies to.
Highest order value or weight, in grams, the rate applies to.
Fastest estimated delivery, in days.
Slowest estimated delivery, in days.
Carrier of a carrier rate. Only allingo is supported.
AllinGo service ids; required (non-empty) for CARRIER_QUOTE
Signed VND added to the carrier quote
Example
-5000Whether the rate is offered at checkout.
Position of the rate in the zone’s list.
Responses
Section titled “Responses”object
Kind of delivery.
FIXED charges amount; CARRIER_QUOTE takes the price from the carrier at checkout.
What the rate’s min_value and max_value are measured on: NONE, the order value or the weight in grams.
Why an active carrier rate cannot produce options right now: carrier_not_connected, or null.
Rate ID.
ID of the zone the rate belongs to.
Name shown to the shopper at checkout.
Fee charged for a fixed rate; 0 means free. Always 0 for a carrier rate.
Lower bound of the condition, or null.
Upper bound of the condition, or null.
Fastest estimated delivery in days, or null.
Slowest estimated delivery in days, or null.
Carrier of a carrier rate: allingo. Null for a fixed rate.
IDs of the carrier services a carrier rate offers. Empty for a fixed rate.
Amount added to the carrier’s quote; may be negative. 0 for a fixed rate.
Whether the rate is offered at checkout.
Position of the rate in the zone’s list.
Example
{ "delivery_type": "STANDARD", "rate_type": "FIXED", "condition_type": "NONE", "active_reason": "carrier_not_connected"}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}