How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Sanity v3 upgrade: Getting undefined error for products schema

7 repliesLast updated: Dec 2, 2025

Hello,So I made the mistake of trying to integrate shopify into my project and upgrading to v3 at the same time haha.

I am pretty sure I did the update right, I am getting a undefined error for my products though. Was wondering if you guys can check my schema file as see if its v3 compliant
AI Update

I totally understand the pain of doing two major changes at once - that definitely makes debugging trickier! Let me help you figure out what's going on with your product schema for v3.

First, the good news: when using Sanity Connect for Shopify, the product data structure is actually handled automatically by the integration. You don't need to manually define a store object field in your schema - that's created automatically when Shopify products sync to your Sanity dataset.

What Actually Happens with Sanity Connect:

When you install and configure Sanity Connect for Shopify, it automatically creates product documents in your Sanity dataset. The Shopify data (title, variants, prices, etc.) appears in a read-only store property on these documents, but this is handled by the integration itself, not something you define in your schema.

Your Product Schema Should Look Like This for v3:

import {defineType, defineField} from 'sanity'

export default defineType({
  name: 'product',
  title: 'Product',
  type: 'document',
  fields: [
    // Add your CUSTOM fields here - not the store object
    defineField({
      name: 'customDescription',
      title: 'Custom Description',
      type: 'text',
    }),
    defineField({
      name: 'seo',
      title: 'SEO',
      type: 'object',
      fields: [
        {name: 'title', type: 'string'},
        {name: 'description', type: 'text'}
      ]
    })
    // The 'store' object with Shopify data is added automatically
  ]
})

Key v3 Migration Points:

Common Causes of Your Undefined Error:

Quick Debugging Steps:

The most likely culprit is either that the initial sync hasn't finished yet, or your code is trying to access Shopify fields directly instead of through the store object. Let me know what you find when you inspect a product document!

Show original thread
7 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions