You are viewing the v1 Nacelle Docs for existing merchants.New merchants can find the V2 docs here: nacelle.com/docs.

# Nacelle App for Sanity

The @nacelle/sanity-plugin-pim-linker (opens new window) package is a Sanity Studio (opens new window) plugin that provides a custom input component (opens new window) for referencing product & collection data stored in Nacelle indices.

Expand to see the custom input component in action! The Nacelle PIM Linker component is used in Sanity Studio to select products stored in Nacelle's indices

# Installation & Setup

In your Sanity Studio project:

# Install Peer Dependencies

npm i @sanity/ui styled-components

# Install the plugin

sanity install @nacelle/sanity-plugin-pim-linker

# Credentials

You'll need to provide the ID and Token associated with your Nacelle space. These credentials can be found in the Nacelle Dashboard (opens new window).

You can add these credentials in one of two ways:

# in ./config/@nacelle/sanity-plugin-pim-linker.json

{
  "nacelleSpaceId": "<your-nacelle-space-id>",
  "nacelleSpaceToken": "<your-nacelle-graphql-token>"
}

# in .env.development / .env.production

SANITY_STUDIO_NACELLE_SPACE_ID=your-nacelle-space-id
SANITY_STUDIO_NACELLE_SPACE_TOKEN=your-nacelle-graphql-token

# Use in Schema Documents

Set the type field to nacelleData to use the custom input component:

{
  name: 'handle',
  title: 'Handle',
  type: 'nacelleData',
}

# Options

By default, the custom input component allows you to choose a handle from either products or collections.

Realistically, you probably want to restrict the component to either products or collections. To do that, provide either ['products'] or ['collections'] to options.dataType:

// example: collections ONLY
{
  name: 'collectionHandle',
  title: 'Collection',
  type: 'nacelleData',
  options: {
    dataType: ['collections']
  }
}
// example: products ONLY
{
  name: 'productHandle',
  title: 'Product',
  type: 'nacelleData',
  options: {
    dataType: ['products']
  }
}