Tom Sailors
· Refreshed
Brief · Anonymized case study

ShipEngine Rates with Failover

Implement a delivery function that captures cart and address data at checkout, then invoke both ShipEngine and Shopify's native rates in parallel. Return whichever set of rates responds within 800ms. Log timeout events to a monitoring dashboard so reliability can be tracked and the threshold adjusted as needed.

A Shopify Plus merchant needs live carrier rates at checkout without stalling the transaction. When a third-party rate engine takes too long to respond, checkout must fall back to Shopify's native rates automatically. The merchant requires sub-second reliability at the moment of purchase.
Four pieces
Shipping

Delivery Rates Function

Captures the cart and delivery address at checkout, then decides which rate engine to use based on response speed.

Shopify Function + Backend service
extensions/delivery-function/src/run.graphql function
query Input {
  cart {
    lines {
      id
      quantity
      merchandise {
        __typename
        ... on ProductVariant {
          id
          product {
            id
            handle
            metafield(namespace: "shipengine", key: "carrier_code") { value }
          }
        }
      }
      cost {
        totalAmount { amount }
      }
    }
    deliveryGroups {
      deliveryAddress {
        address1
        city
        provinceCode
        zip
        countryCode
      }
    }
    buyerIdentity {
      customer { id }
    }
  }
}
Changed postalCode to zip on MailingAddress type.
Shipping

Rate Engine Resolver

Backend service that receives cart and address data, fires ShipEngine and native rates in parallel, and returns whichever answers within 800ms.

Heroku-hosted Node backend
Shipping

ShipEngine Connector

Pulls live carrier rates directly from ShipEngine, formatted as Shopify delivery options for checkout.

Node.js + ShipEngine API client
Shipping

Failover & Monitoring

Logs timeouts and successes so you can track ShipEngine reliability and adjust the timeout if needed.

Monitoring dashboard + logs

Got a similar problem?

Sketch your build in 30 seconds — voice, type, or attach a screenshot.

Sketch the build →