return
Returns a response from http and ingShipping Rate scripts.
Below code will return shipping rate with name OVERSIZE if total quantity of items is greater than 25
{% assign total_quantity = 0 %}
{% for item in request.body.rate.items %}
{% assign total_quantity = total_quantity | plus: item.quantity %}
{% endfor %}
{% json response %}
{
"body": {
"rates": [
{% if total_quantity > 25 %}
{
"service_name": "OVERSIZE",
"service_code": "OVERSIZE",
"total_price": "4000",
"description": "Oversize shipping rate",
"currency": "USD"
}
{% endif %}
]
}
}
{% endjson %}
{% return response %}
Last updated