Loading...

Referencing external DB data on Shopify: metaobjects vs live fetch

A replacement-parts merchant keeps compatibility data in an external database: which parts fit which equipment models. Buyers need to see compatibility on product pages. Live fetch from an external DB is slow and fragile; metaobjects synced in are the right fit.

Manufacturing parts compatibility

An industrial parts supplier sells thousands of replacement parts for manufacturing equipment. Buyers need compatibility information on every product page - which equipment models, which serial ranges, which years. The compatibility data lives in a purpose-built external database that the merchant's ops team maintains. How do you surface this on Shopify product pages?

Three architectural approaches show up. Two fail in ways specific to Shopify themes.

What doesn't work

Live fetch from the external database via a client-side JavaScript call. Every product page view hits the external DB. Slow, fails when the external system is down, exposes database contents to uncontrolled traffic, creates an unbounded cost vector. Buyer UX suffers - the product page is partially rendered while compatibility data loads.

Live fetch from a Shopify app proxy. Cleaner than direct client calls but still bottlenecked on the external DB's response time and availability. Product pages pay an external round-trip per render. Caching helps but adds its own complexity.

Duplicate the entire external database into per-product metafields. The database has tens of thousands of compatibility records. Metafields don't scale to that volume per product, and the merchant's admin UI becomes unusable.

The pattern that works

Sync external data into Shopify metaobjects on a schedule, then reference from products.

Structure:

Metaobject definition: equipment_compatibility

  • equipment_model - single-line text (e.g., "Series 500 Press")
  • year_range - single-line text (e.g., "2018-2023")
  • serial_range - single-line text
  • notes - rich text (special fitment notes)
  • part_numbers - list of single-line text (compatible parts)

Sync job (external DB → Shopify metaobjects) runs on a schedule:

  • Daily for slow-changing data (equipment models)
  • Hourly for faster-changing data (active compatibility updates)
  • Real-time via webhook for critical updates (recall situations)

Product metafield compatible_equipment - list of metaobject references to equipment_compatibility entries.

Sync architecture

The sync layer lives outside Shopify:

Daily / hourly scheduled sync:

  • Runs in Azure Functions, AWS Lambda, a Shopify Workflow runner, or cron on a VM
  • Queries the external DB for records modified since last sync
  • Upserts matching Shopify metaobject entries via Admin GraphQL API
  • Logs sync run to Shopify admin log extension or external monitoring

Real-time webhook (for critical data):

  • External DB publishes a webhook on change
  • Receiver (Azure Function or Logic App) updates the specific metaobject entry in Shopify

The merchant sees current data on product pages without exposing the external DB to customer traffic.

Product pages rendering

The product template references the equipment metaobjects and renders the compatibility table:

The page renders with cached, Shopify-served data. No external DB call on render. Sub-second page loads even on catalog pages listing many products.

Why metaobject beats per-product metafield here

  • Compatibility entries are reusable: one equipment model is compatible with dozens of parts. One metaobject entry, many product references.
  • Admin editability is clean: ops team edits equipment data from a single admin surface, not by opening hundreds of products.
  • Sync logic is simple: sync creates/updates metaobject entries and links products to them, rather than writing inline data to each product metafield.

Data volume considerations

Shopify metaobjects have platform limits. Hundreds to low thousands of entries per definition is well-supported. Tens of thousands starts to stress the admin UI and sync performance.

For very large compatibility databases (100k+ entries), alternate patterns:

  • App-based pattern: a custom app serves compatibility data via a theme app extension, with the app backing a local cache synced from the external DB
  • Search-driven pattern: use Shopify's search API + structured facets; compatibility data becomes searchable without being stored in metaobjects
  • Hybrid: the most-queried compatibility records as metaobjects, long-tail in the app-backed service

For this merchant's typical volume (hundreds of equipment models, thousands of parts), pure metaobject pattern fits.

Search and filtering

A common follow-up: buyers want to search "show me parts compatible with equipment model X". The metaobject approach supports this via:

  • Product filters referencing metaobject field values
  • Search integrations indexing metaobject data
  • Custom collection rules filtering products by compatibility reference

What ships with this pattern

A production compatibility-display implementation has:

  • Equipment compatibility metaobject definition
  • Scheduled sync job keeping metaobjects current with external DB
  • Product metafields linking products to compatibility entries
  • Theme section rendering the compatibility table
  • Monitoring on sync job health (last run, records synced, failures)
  • Fallback graceful-degrade when metaobject ref is missing
  • Runbook for when compatibility data needs emergency update

The external database stays the source of truth for ops. Shopify stays fast for buyers. The sync layer bridges them. That's the architectural separation that keeps both systems healthy.

Contact Us Now

Share Your Story

We build trust by delivering what we promise – the first time and every time!

We'd love to hear your vision. Our IT experts will reach out to you during business hours to discuss making it happen.

WHY CHOOSE US

"Collaborate, Elevate, Celebrate where Associates - Create Project Excellence"

SapotaCorp beyond the IT industry standard, we are

  • Certificated
  • Assured quality
  • Extra maintenance

Tell us about your project

close