{% liquid
assign has_hazmat = false
for item in shopify_rate_check.items
if item.sku | upcase contains "HAZ"
assign has_hazmat = true
endif
endfor
assign standard_price = 1500
assign express_price = 2900
%}
{
"rates": [
{
"service_name": {{ "Ground Shipping" | json }},
"service_code": "GROUND",
"currency": {{ shopify_rate_check.currency | json }},
"total_price": {{ standard_price }},
"description": {{ "Always available ground transport" | json }}
}
{% unless has_hazmat %}
,
{
"service_name": {{ "Express Air" | json }},
"service_code": "EXPRESS",
"currency": {{ shopify_rate_check.currency | json }},
"total_price": {{ express_price }},
"description": {{ "2-day express delivery" | json }}
}
{% endunless %}
]
}