1.0.9 • Published 1 year ago

@jetskis/headup v1.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

sanity-plugin-headup

This is a Sanity Studio v3 plugin.

First you'll need to install the Shopify App from the App Store

Some link to the Shopify App

Installation

npm install sanity-plugin-headup

Usage

Add it as a plugin in sanity.config.ts (or .js):

import {defineConfig} from 'sanity'
import {headup} from '@jetskis/sanity-plugin-headup'

export default defineConfig({
  //...
  plugins: [headup({
    {
      "apiKey": "[keyProvidedFromShopifyApp]",
      "store": "yourshopifystore.myshopify.com"
    }
  })],
})

Then simply update any instance of image in your sanity schema with type: shopifyImage.

    ...,
    defineField({
      name: 'image',
      title: 'Image ',
      type: 'shopifyImage',
      validation: (Rule) => Rule.required(),
    }),

We also support uploading directly to a product image, this is useful if you don't want the client to worry about managing image assets in Shopify at all (You need an image for the cart and emails to be present in Shopify), you can pass options:

    options: {
      productImage: true,
      productId: `store.id` // points to the field with the shopify product Id
    },

'store.id' is the shopify product id field on the product content type, this assumes you're using the sanity-connect sync, if you're doing a manual sync make sure you specify the product id location in the document schema.

License

MIT © Kevin Green

1.0.9

1 year ago

1.0.8

1 year ago