Update an attribute based shipping option
Updates an attribute based shipping option. The linked shipping option, the rule, the calculator and the name must all be supplied, and the linked shipping option must exist; otherwise the request fails with a validation error and the stored record is left untouched.
Fields left out of the request body — such as is_active or sort_order — keep their current values rather than being reset to their defaults.
Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.
The unique identifier of the attribute based shipping option.
Fields for updating an attribute based shipping option.
The linked shipping option, the rule, the calculator and the name are mandatory; the remaining fields are optional and keep their current values when omitted.
Identifier of an existing shipping option to link. Must refer to a shipping option that exists.
4Calculator configuration, applied to the shipping cost of a matched item group instead of the linked shipping option's own calculator. The object must contain a slug key identifying the calculator. See the Shipping Rules & Calculators guide for available calculators and their parameters.
{"slug":"fixed-price-calculator","fixed_price":"19.99"}Rule configuration, applied instead of the linked shipping option's own rule. The object must contain a slug key identifying the rule. See the Shipping Rules & Calculators guide for available rules and their parameters.
{"slug":"product-attribute-rule","name":"Product Attribute Rule","func":"all","attribute_field":"shipping_group","attribute_value":"vendor_b"}Descriptive name of the record.
Vendor B — StandardWhether the record is active. Omit to keep the current value.
Sort order used when evaluating records at checkout. Omit to keep the current value.
The updated attribute based shipping option.
An attribute based shipping option returned by the API.
Unique identifier of the attribute based shipping option.
Descriptive name of the record, used to tell apart several records that reuse the same shipping option.
Vendor A — StandardWhether the record is active. Only active records are evaluated at checkout.
trueCalculator configuration. Determines how the shipping cost of a matched item group is computed, overriding the calculator of the linked shipping option.
The object must contain at minimum a slug key identifying the calculator. See the Shipping Rules & Calculators guide for available calculators and their parameters.
{"slug":"amount-based-calculator","amounts":[{"min_amount":"0.00","max_amount":"250.00","shipping_amount":"14.99"},{"min_amount":"250.00","max_amount":null,"shipping_amount":"0.00"}]}Rule configuration. Determines which item groups this option is offered for, overriding the rule of the linked shipping option.
The object contains a slug key identifying the rule. Records created with an empty rule are stored with the "any rule", which makes the option eligible for every group.
{"slug":"any-rule","name":"Any Rule"}Sort order used when evaluating records at checkout. Lower values are evaluated first.
0The request contains invalid or missing data.
Authentication credentials were not provided or are invalid.
The authenticated user does not have administrator privileges.
The requested attribute based shipping option does not exist.
PUT /api/v1/remote/1/attribute_based_shipping_options/{id}/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 304
{
"shipping_option": 4,
"calculator": {
"slug": "fixed-price-calculator",
"fixed_price": "19.99"
},
"rule": {
"slug": "product-attribute-rule",
"name": "Product Attribute Rule",
"func": "all",
"attribute_field": "shipping_group",
"attribute_value": "vendor_b"
},
"name": "Vendor B — Standard",
"is_active": false,
"sort_order": 1
}{
"pk": 12,
"name": "Vendor A — Standard",
"is_active": true,
"calculator": {
"slug": "fixed-price-calculator",
"fixed_price": "14.99"
},
"rule": {
"slug": "any-rule",
"name": "Any Rule"
},
"sort_order": 0,
"shipping_option": {
"pk": 4,
"name": "Vendor Standard Shipping",
"slug": "vendor-standard-shipping",
"is_active": true,
"sort_order": 0,
"description": null,
"kwargs": {
"required_fields": []
},
"delivery_type": {
"value": "standard",
"label": "Standard Delivery"
}
}
}Last updated
Was this helpful?

