shipping-methods
- shipping-methods.compute-costs
- shipping-methods.find
- shipping-methods.get
- shipping-methods.count
- shipping-methods.create
- shipping-methods.update
- shipping-methods.delete
shipping-methods.compute-costs
Calculates shipping costs for one or more goods.
Request
Admin SDKAdmin.api('commerce.shipping-methods.compute-costs', request, function(response) { … });
HTTP POST/api/v6/commerce.shipping-methods.compute-costs
{
"goods" : [ { // goods for witch calculate the costs (required)
"weight" : 12.780, // weight (required) - decimal[8,3](0…)
"quantity" : 5.00, // number of products (required) - decimal[10,2](0…)
"subtotal" : 127.970, // subtotal (required) - decimal[10,3]
"taxedSubtotal" : 152.280 // subtotal taxes included (required) - decimal[10,3]
}, … ],
"conditions" : { // returns the costs only for the shipping methods …
"ids" : [ 3, 1, … ], // … with these identifiers - int(1…)
"isActive" : true, // … that are visible or not on shop - bool
"country" : "GB", // … that are applicable to this country (ISO code) - string(2)
"stateProv" : "LND" // … that are applicable to this state/province/county (ISO code) - string(1…3)
}
}
Response
{
"status" : "ok",
"costs" : [ { // costs for each good and each shipping method (id) - int(1…) -> decimal[8,3](0…)
"1" : 5.295,
"3" : 8.060
}, … ]
}
shipping-methods.find
Returns the shipping methods that meet the given conditions.
Request
Admin SDKAdmin.api('commerce.shipping-methods.find', request, function(response) { … });
HTTP POST/api/v6/commerce.shipping-methods.find
{
"conditions" : { // returns only the shipping methods …
"ids" : [ 3, 1, … ], // … with these identifiers - int(1…)
"isActive" : true, // … that are visible or not visible on the shop - bool
"isDefault" : false, // … that are the default shipping method or not - bool
"country" : "GB", // … that are applicable to this country (ISO code) - string(2)
"stateProv" : "LND", // … that are applicable to this state/province/county (ISO code) - string(1…3)
"weight" : 23.893, // … that are applicable to this weight - decimal[8,3](0…)
"quantity" : 5.00, // … that are applicable to this number of products - decimal[10,2](0…)
"subtotal" : 175.780, // … that are applicable to this subtotal - decimal[10,3](0…)
"after" : 3 // … with identifier after this value - int(0…) },
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "name", … ], // fields to return - string
"order" : [ "name" ], // sort order of returned shipping methods, can contain "id", "-id", "name", "-name", "isDomestic", "-isDomestic",
// "isInsured", "-isInsured", "isActive", "-isActive", "paymentOnDelivery" and "-paymentOnDelivery" - string
"limit" : 10, // maximum number of shipping methods to return - int(1…)
"first" : 0 // index of the first shipping method to return - int(0…)
}
Response
{
"status" : "ok",
"shippingMethods" : [ {
"id" : 3, // identifier - int(1…)
"name" : { // name - string(2) -> string(0…80)
"en" : "Next day",
"it" : "Giorno successivo"
},
"basedOn" : "Weight", // indicates on what the cost is based, can be "Weight", "Quantity" or "Subtotal" - string
"isDomestic" : false, // indicates if it is domestic - bool
"isInsured" : true, // indicates if it is insured - bool
"isActive" : true, // indicates if it is visible on shop - bool
"isDefault" : false, // indicates if it is the default shipping method - bool
"paymentOnDelivery" : 9, // payment method (id) on delivery that can be used with this shipping method (can be null) - int(1…)
"shippingRates" : [ { // shipping cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 5.000, // to this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"fixedCost" : 5.600, // … apply this fixed cost - decimal[8,3](0…)
"unitCost" : 0.550 // … apply this unit cost - decimal[8,3](0…)
}, … ],
"insuranceRates" : [ { // insurance cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 25.000, // to this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"fixedCost" : 2.000, // … apply this fixed cost - decimal[8,3](0…)
"percentCost" : 0.25 // … apply this percent cost - decimal[4,2](0…)
}, … ],
"taxClass" : 7, // tax class (id) to use for tax calculation (can be null) - int(1…)
"zones" : [ "GB", … ] // countries, provinces, states or counties witch it is applied - string(1…3) }, … ]
}
shipping-methods.get
Returns a shipping method given its identifier.
Request
Admin SDKAdmin.api('commerce.shipping-methods.get', request, function(response) { … });
HTTP POST/api/v6/commerce.shipping-methods.get
{
"id" : 3, // identifier - int(1…)
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "name", … ] // fields to return - string
}
Response
{
"status" : "ok",
"shippingMethod" : { // (can be null)
"id" : 3, // identifier - int(1…)
"name" : { // name - string(2) -> string(0…80)
"en" : "Next day",
"it" : "Giorno successivo"
},
"basedOn" : "Weight", // indicates on what the cost is based, can be "Weight", "Quantity" or "Subtotal" - string
"isDomestic" : false, // indicates if it is domestic - bool
"isInsured" : true, // indicates if it is insured - bool
"isActive" : true, // indicates if it is visible on shop - bool
"isDefault" : false, // indicates if it is the default shipping method - bool
"paymentOnDelivery" : 9, // payment method (id) on delivery that can be used with this shipping method (can be null) - int(1…)
"shippingRates" : [ { // shipping cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 5.000, // to this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"fixedCost" : 5.600, // … apply this fixed cost - decimal[8,3](0…)
"unitCost" : 0.550 // … apply this unit cost - decimal[8,3](0…)
}, … ],
"insuranceRates" : [ { // insurance cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 25.000, // to this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"fixedCost" : 2.000, // … apply this fixed cost - decimal[8,3](0…)
"percentCost" : 0.25 // … apply this percent cost - decimal[4,2](0…)
}, … ],
"taxClass" : 7, // tax class (id) to use for tax calculation (can be null) - int(1…)
"zones" : [ "GB", … ] // countries, provinces, states or counties witch it is applied - string(1…3) }
}
shipping-methods.count
Number of shipping methods that meet the given conditions.
Request
Admin SDKAdmin.api('commerce.shipping-methods.count', request, function(response) { … });
HTTP POST/api/v6/commerce.shipping-methods.count
{
"conditions" : { // counts only the shipping methods …
"ids" : [ 3, 1, … ], // … with these identifiers - int(1…)
"isActive" : true, // … that are visible or not visible on the shop - bool
"isDefault" : false, // … that are the default shipping method or not - bool
"country" : "GB", // … that are applicable to this country (ISO code) - string(2)
"stateProv" : "LND", // … that are applicable to this state/province/county (ISO code) - string(1…3)
"weight" : 23.893, // … that are applicable to this weight - decimal[8,3](0…)
"quantity" : 5.00, // … that are applicable to this number of products - decimal[10,2](0…)
"subtotal" : 175.780, // … that are applicable to this subtotal - decimal[10,3](0…)
"after" : 3 // … with identifier after this value - int(0…) }
}
Response
{
"status" : "ok",
"count" : 4 // number of shipping methods - int(0…)
}
shipping-methods.create
Creates a new shipping method.
Request
Admin SDKAdmin.api('commerce.shipping-methods.create', request, function(response) { … });
HTTP POST/api/v6/commerce.shipping-methods.create
{
"shippingMethod" : { // shipping method to create (required)
"name" : { // name - string(2) -> string(0…80)
"en" : "Next day",
"it" : "Giorno successivo"
},
"basedOn" : "Weight", // indicates on what cost is based, can be "Weight", "Quantity" or "Subtotal" (required) - string
"isDomestic" : false, // indicates if it is domestic - bool
"isActive" : true, // indicates if it is visible on shop - bool
"isDefault" : false, // indicates if it is the default shipping method - bool
"paymentOnDelivery" : 9, // payment method (id) on delivery that can be used with this shipping method (can be null) - int(1…)
"shippingRates" : [ { // shipping cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 5.000, // to this value ( of weight, quantity or subtotal ) (required) - decimal[8,3](0…)
"fixedCost" : 5.600, // … apply this fixed cost - decimal[8,3](0…)
"unitCost" : 0.550 // … apply this unit cost - decimal[8,3](0…)
}, … ],
"insuranceRates" : [ { // insurance cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 25.000, // to this value ( of weight, quantity or subtotal ) (required) - decimal[8,3](0…)
"fixedCost" : 2.000, // … apply this fixed cost - decimal[8,3](0…)
"percentCost" : 0.25 // … apply this percent cost - decimal[4,2](0…)
}, … ],
"taxClass" : 7, // tax class (id) to use for tax calculation (can be null) - int(1…)
"zones" : [ "GB", … ] // countries, provinces, states or counties witch it is applied - string(1…3)
}
}
Response
{
"status" : "ok",
"id" : 3 // identifier of the new shipping method - int(1…)
}
Errors
Field | Type | Description |
---|---|---|
country | Malformed | Country <zone> is not a valid country code |
paymentOnDelivery | NotFound | Payment method <paymentOnDelivery> does not exist |
shippingRates | Malformed | There cannot be more than 250 rates |
stateProv | Malformed | State or province <zone> is not a valid stateprov code |
taxClass | NotFound | Tax class <taxClass> does not exist |
shipping-methods.update
Updates a shipping method. Any fields left out of the request will remain unchanged.
Request
Admin SDKAdmin.api('commerce.shipping-methods.update', request, function(response) { … });
HTTP POST/api/v6/commerce.shipping-methods.update
{
"id" : 3, // identifier of the shipping method to update (required)
"shippingMethod" : { // shipping method's fields to update (required)
"name" : { // name - string(2) -> string(0…80)
"en" : "Next day",
"it" : "Giorno successivo"
},
"isActive" : true, // indicates if it is visible on shop - bool
"isDefault" : false, // indicates if it is the default shipping method - bool
"paymentOnDelivery" : 9, // payment method (id) on delivery that can be used with this shipping method (can be null) - int(1…)
"shippingRates" : [ { // shipping cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 5.000, // to this value ( of weight, quantity or subtotal ) (required) - decimal[8,3](0…)
"fixedCost" : 5.600, // … apply this fixed cost - decimal[8,3](0…)
"unitCost" : 0.550 // … apply this unit cost - decimal[8,3](0…)
}, … ],
"insuranceRates" : [ { // insurance cost rates
"start" : 0.000, // from this value ( of weight, quantity or subtotal ) - decimal[8,3](0…)
"limit" : 25.000, // to this value ( of weight, quantity or subtotal ) (required) - decimal[8,3](0…)
"fixedCost" : 2.000, // … apply this fixed cost - decimal[8,3](0…)
"percentCost" : 0.25 // … apply this percent cost - decimal[4,2](0…)
}, … ],
"taxClass" : 7, // tax class (id) to use for tax calculation (can be null) - int(1…)
"zones" : [ "GB", … ] // countries, provinces, states or counties witch it is applied - string(1…3)
}
}
Response
{
"status" : "ok"
}
Errors
Field | Type | Description |
---|---|---|
country | Malformed | Country <zone> is not a valid country code |
isDefault | Malformed | 'isDefault' can not be false |
paymentOnDelivery | NotFound | Payment method <paymentOnDelivery> does not exist |
shippingRates | Malformed | There cannot be more than 250 rates |
stateProv | Malformed | State or province <zone> is not a valid stateprov code |
taxClass | NotFound | Tax class <taxClass> does not exist |
shipping-methods.delete
Deletes one o more shipping methods.
Request
Admin SDKAdmin.api('commerce.shipping-methods.delete', request, function(response) { … });
HTTP POST/api/v6/commerce.shipping-methods.delete
{
"ids" : [ 3, 1, … ] // identifiers of the shipping methods to delete (required) - int(1…)
}
Response
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
ids | CannotDelete | Shipping method <id> can not be deleted because is the default method |