comecerodocs

Create a shipping method in settings

POST
/settings/shipping/methods

Adds a shipping method to the shipping settings. Comecero sets its method_id from the description and countries. Give exactly one set of rules: quantity_rules, subtotal_rules or weight_rules. Gaps between ranges are closed when saved. Carts and invoices are not priced from these settings: shoppers only see the methods made with POST /shipping_methods. Secret and trusted tokens may call it when their permissions allow updates to settings_shipping. Limited tokens may not.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Request Body

application/json
  1. body

A shipping method. Send description, countries and exactly one of quantity_rules, subtotal_rules or weight_rules. This is checked on update too, so an update must send them again.

description*string

The name the shopper sees. Up to 75 characters.

Lengthlength <= 75
details?|

More text for the shopper. Up to 125 characters.

Lengthlength <= 125
countries*array<string>

Two-letter ISO country codes, up to 50, or * on its own for every country.

Items1 <= items <= 50
quantity_rules?array<>

Prices by item count.

subtotal_rules?array<>

Prices by order subtotal.

weight_rules?array<>

Prices by order weight.

adjustments?array<>|

Extra charges for some US states or Canadian provinces.

Response Body

The new shipping method.

application/json
  1. response

One shipping method in the shipping settings: the countries it serves and how its price is worked out. A method has exactly one set of rules: by quantity, by order subtotal or by weight.

object?"settings_shipping.method"

The object type. Always settings_shipping.method.

Value in"settings_shipping.method"
url?string

The URL of this method.

Formaturi
method_id?string

The method ID. Comecero makes it from the description and countries when the method is created. It does not change after that.

description?string

The name the shopper sees, such as Standard Shipping. Up to 75 characters.

Lengthlength <= 75
details?|

More text for the shopper, such as delivery times. Up to 125 characters.

Lengthlength <= 125
countries?array<string>

Two-letter ISO country codes the method ships to, up to 50. Or * on its own for every country.

Items1 <= items <= 50
quantity_rules?array<>|

Prices by the number of items in the order.

subtotal_rules?array<>|

Prices by the order subtotal, one entry per currency.

weight_rules?array<>|

Prices by the total weight of the order.

adjustments?array<>|

Extra charges for some states or provinces, such as Alaska and Hawaii. Only for the United States and Canada.

formatted?

Display text. Returned only when formatted=true.

Example Request
curl -X POST 'https://api.comecero.com/api/v1/settings/shipping/methods' \  -H 'Content-Type: application/json' \  -d '{  "description": "Standard Shipping",  "details": "Arrives in 3 to 5 business days.",  "countries": [    "US"  ],  "subtotal_rules": [    {      "currency": "USD",      "ranges": [        {          "minimum": 0,          "maximum": 49.99,          "price": 5        },        {          "minimum": 50,          "maximum": 999999,          "price": 0        }      ]    }  ]}'
Example Response
{  "object": "settings_shipping.method",  "url": "https://api.comecero.com/api/v1/settings/shipping/methods/standard-shipping-us",  "method_id": "standard-shipping-us",  "description": "Standard Shipping",  "details": "Arrives in 3 to 5 business days.",  "countries": [    "US"  ],  "quantity_rules": null,  "subtotal_rules": [    {      "currency": "USD",      "ranges": [        {          "minimum": 0,          "maximum": 49.99,          "price": 5        },        {          "minimum": 50,          "maximum": 999999,          "price": 0        }      ]    }  ],  "weight_rules": null,  "adjustments": [    {      "country": "US",      "regions": [        "AK",        "HI"      ],      "percentage": null,      "amounts": [        {          "price": 10,          "currency": "USD"        }      ]    }  ]}