Updating a Shipping Rule
Endpoint: PUT /admin/shipping_rules/{shipping_rule_id}
Purpose
This endpoint updates an existing shipping rule by its unique ID. It allows admins to modify the rule’s name, associated shipping policy, shipping class, zones, and description. This is essential for maintaining flexible, region-specific shipping logic as business needs or logistics partners evolve.
Path Parameters
Parameter | Type | Description |
---|---|---|
shipping_rule_id | Integer | The ID of the shipping rule to update. |
Query Parameters
No query parameters for this endpoint.
Use Case
An admin updates a previously created shipping rule to apply a different shipping policy and change the assigned shipping class and zone configuration. This is helpful during pricing strategy updates, shipping provider changes, or when introducing zone-specific delivery options.
Request Body
Key | Type | Description |
---|---|---|
name | String | Name of the shipping rule. |
profile_id | String | ID of the associated shipping profile. |
shipping_class | String | ID of the related shipping class. |
shipping_policy | String | ID of the shipping policy applied to this rule. |
zones | Array of Objects | List of zone objects that this rule applies to (each with an id ). |
description | String | Description of the shipping rule. |
{
"shipping_rule": {
"name": "SHIPPING_RULE_NAME",
"profile_id": "SHIPPING_PROFILE_ID",
"shipping_class": "SHIPPING_CLASS_ID",
"shipping_policy": "SHIPPING_POLICY_ID",
"zones": [
{
"id": ZONE_ID_1
},
{
"id": ZONE_ID_2
}
],
"description": "SHIPPING_RULE_DESCRIPTION"
}
}
Response
Returns the updated shipping rule object, including rule ID, new name, linked shipping policy and class, updated zones, and timestamps. This response confirms the changes and ensures the admin can verify the update was successfully applied.
{
"shipping_rule": {
"id": SHIPPING_RULE_ID,
"name": "SHIPPING_RULE_NAME",
"shipping_policy": {
"id": SHIPPING_POLICY_ID,
"name": "SHIPPING_POLICY_NAME"
},
"shipping_class": {
"id": SHIPPING_CLASS_ID,
"name": "SHIPPING_CLASS_NAME"
},
"zones": [
{
"id": ZONE_ID_1,
"name": "ZONE_NAME_1"
},
{
"id": ZONE_ID_2,
"name": "ZONE_NAME_2"
}
],
"description": "SHIPPING_RULE_DESCRIPTION",
"created_at": "YYYY-MM-DDTHH:MM:SS",
"updated_at": "YYYY-MM-DDTHH:MM:SS"
}
}