How to Deploy a Shopify Dashboard Template with GraphQL

3 replies
Last updated: Dec 9, 2021
Hey friends,
I’ve been experimenting with Sanity Connect, the Shopify template and (our version of) Hydrogen today and managed to get your template dashboard running with our sync’d store. I wanted to rely on Sanity’s idea of “right” so I created the studio from within Shopify and attempted to deploy your boilerplate graphql for use with some new components in our Hydrogen repo. It didn’t work straight up, and as the Shopify dashboard template is likely still a WIP I thought it’d be useful to flag the things I had to do to get the schema deployed.

Lifted all problematic inline object definitions (we habitually avoid anonymous objects to protect graphql):
- galleryProduct
- section
- footer
- menu
- linkGroup
- priceRange

Change the settings.ts fields to:

  fields: [
    {
      name: 'menu',
      title: 'Menu',
      type: 'menu'
    },
    {
      name: 'footer',
      title: 'Footer',
      type: 'footer'
    },
    {
      name: 'seo',
      title: 'SEO',
      type: 'seo.standard' // removed your inline seo object
    }
  ],
Removed attributes from options array block in shopifyProduct.ts:

    {
      name: 'options',
      title: 'Options',
      type: 'array',
      of: [
        {
          type: 'productOption' // was 'option' previously
        }
      ]
    },
Dec 9, 2021, 3:11 AM
Thank you for this
user H
– very useful!
Dec 9, 2021, 4:39 AM
I think we might only have run this with GROQ ourselves and therefore have unhoisted, anonymous objects in the model
Dec 9, 2021, 5:13 AM
No worries! Yeah I’d guessed that might be the case, didn’t take long to shuffle the code around so it’s not a really major issue. That product option change is probably the most dangerous, not yet sure what the implications might be but I’ll probably find out soon…
Dec 9, 2021, 5:35 AM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.