Free and Flat Rates
Adding a simple Fat Rate in Decimal is easy. In the top block, simply add this (make sure it is valid JSON, with a comma before and after):
"Flat": {
"enabled": true,
"services": [
{
"code": "STANDARD_SHIPPING",
"total_price": 2000
}
]
},
You will now have a new rate; however, if you click Save and check for rates, you will see "Unknown Service".
To fix this, you can -
EITHER set the "display_text" property directly on the rate like this:
"Flat": {
"enabled": true,
"services": [
{
"code": "STANDARD_SHIPPING",
"total_price": 2000,
"display_text": "Standard Shipping"
}
]
},
OR if you add a "rate_mapping" property then you can map any rate code to a display text (If the "display_text" property is set, then the "rate_mapping" will be ignored):
"rate_mapping": [
{
"carrier": "Flat",
"services": {
"STANDARD_SHIPPING": "Standard Shipping"
}
}
]
To make this rate as Free Shipping, simply set total_cost to 0.
Cheapest Rate
Decimal has a special property called "cheapest". Sometimes, rather than add a Free or Flat rate, you want the cheapest rate to be modified to Free, or even to a Flat Rate, such as '$5 shipping'. You can get this modified rate by adding the "cheapest" property
"cheapest": {
"total_price": 0,
"display_text": "Free Shipping"
}
The cheapest rate will now always have its price modified to 0 and display text changed to "Free Shipping".
If you're wondering how to set this rate to only apply above a certain cart total for example, you can find the answer in the Conditions section.