Skip to main content

Using the Rate Lab Interface

Rate Lab’s workspace is built around three panels that work together to help you design and test shipping rates. This guide will show you how to use each panel and the tools available to you.

The three-panel workspace

Left panel: Your Liquid template

This is your code editor where you write shipping logic using Liquid. Think of it like editing a theme template, but for shipping rates. What you can do:
  • Write Liquid code with syntax highlighting and auto-completion
  • Access order data through the shopify_rate_check object
  • Calculate shipping prices using Liquid filters and logic
  • Return one or more shipping rate options for customers
Tips:
  • The editor supports standard keyboard shortcuts (Ctrl/Cmd+S to save, Ctrl/Cmd+F to find)
  • Liquid syntax errors are highlighted as you type
  • You can undo/redo changes normally

Top right panel: Order context (test data)

This panel shows the order information that Shopify sends to your rate function. It’s formatted as JSON and includes everything you need to make shipping decisions. What’s included:
  • line_items - Products in the cart with quantities, weights, prices, SKUs, and properties
  • destination - Where the order is shipping (country, province, city, postal code)
  • currency - The currency for this order
  • Cart totals, item counts, and more
How to use it:
  • Edit this data to test different scenarios (heavier orders, different countries, more items)
  • Try edge cases: single items, huge orders, international destinations
  • See how your rate logic responds to different inputs
  • Click Run after editing to recalculate rates
Example: Testing a weight-based rate If you’re building a rate that charges more for heavy orders, edit the grams field in a line item to test how your calculation responds.

Bottom right panel: Rate results

This read-only panel shows exactly what shipping options customers will see at checkout after your Liquid template runs. What you’ll see:
  • service_name - The shipping method name (e.g., “Standard Shipping”, “Express”)
  • service_code - An internal identifier
  • total_price - The price in cents (e.g., 995 = $9.95)
  • currency - The currency code
  • description (optional) - Additional information shown to customers
Multiple rates: Your template can return multiple shipping options, giving customers choices like “Standard (9.95)"and"Express(9.95)" and "Express (19.95)”.

Toolbar controls

Run button Click this whenever you change your Liquid template or test data. It recalculates the rates and updates the results panel. Template name field Give your rate function a descriptive name like “Holiday Shipping Rules” or “Multi-Vendor Rates”. This helps when you have multiple rate functions. Auto-update indicator When active, this shows that your workspace automatically updates when changes are saved. You’ll see your rate results refresh in real-time.

Common workflows

Building a new rate from scratch

  1. Clear the left panel and start with this basic structure:
    {
      "rates": [{
        "service_name": "My Shipping Rate",
        "service_code": "CUSTOM",
        "currency": "USD",
        "total_price": 1000
      }]
    }
    
  2. Add Liquid logic to calculate total_price based on order data
  3. Click Run to test
  4. Iterate until the rate behaves as expected

Testing different scenarios

  1. Start with your working template in the left panel
  2. Edit the order context (top right) to simulate different orders:
    • Change item quantities
    • Modify destination country or postal code
    • Adjust product weights or prices
  3. Click Run after each change
  4. Verify the rate results (bottom right) match your expectations

Copying an example

  1. Browse the Shipping Examples section
  2. Copy the Liquid code from an example that’s close to what you need
  3. Paste it into your left panel
  4. Modify the logic for your specific requirements
  5. Test with your order data

Quick tips

Prices are in cents Always work with prices in cents/pennies. $9.95 = 995, not 9.95. Use the json filter When outputting strings in JSON, use {{ my_variable | json }} to properly escape quotes and special characters. Test edge cases Try extreme scenarios: empty carts, single items, international orders, very heavy shipments. Your rate logic should handle all cases gracefully. Check your math If rates seem wrong, use Liquid’s math filters step by step and verify each calculation in the results.

Next steps