Skip to main content

Understanding Your Order Data

When calculating shipping rates, your Liquid template has access to detailed information about the order through the shopify_rate_check object. This page explains what data is available and how to use it.

The rate check object

In the top right panel of Rate Lab, you’ll see a JSON object containing all the order information Shopify provides. Your Liquid template accesses this data to make shipping decisions.

Basic structure

Line items (products in cart)

Access products using shopify_rate_check.items or shopify_rate_check.line_items:

Common patterns with items

Calculate total weight:
Calculate cart subtotal:
Count items by SKU:
Filter by vendor:
Check for specific products:

Destination (shipping address)

Access shipping address details:

Geographic logic examples

Charge more for Alaska/Hawaii:
Block PO boxes:
International surcharge:

Currency

The order’s currency is available at:
Always return rates in the same currency:

Product properties and metafields

Items can have custom properties and metafields that you can use in your logic:

Advanced: Working with variants

Some rate checks include variant information:

Testing different scenarios

In Rate Lab’s top right panel, you can edit this data to test how your rates respond: Test heavier orders: Change "grams": 500 to "grams": 5000 on an item Test international shipping: Change "country_code": "US" to "country_code": "CA" Test high-value orders: Change item prices or quantities to create a large cart total Test specific products: Add or remove items, change SKUs, modify vendor names

Prices are always in cents

Remember: all price values in Rate Lab are in cents (or smallest currency unit):
  • "price": 1995 = $19.95
  • "price": 50 = $0.50
  • Your total_price should also be in cents

Next steps

Now that you understand what data is available, explore how to use it: