{"id":22542145,"url":"https://github.com/commercelayer/sanity-commerce","last_synced_at":"2025-04-09T22:43:10.100Z","repository":{"id":218723652,"uuid":"742538840","full_name":"commercelayer/sanity-commerce","owner":"commercelayer","description":"Sanity Commerce by Commerce Layer","archived":false,"fork":false,"pushed_at":"2024-08-12T10:36:26.000Z","size":6717,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-24T00:41:23.043Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.sanity.io/plugins/sanity-commerce","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commercelayer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-12T17:49:36.000Z","updated_at":"2024-08-19T07:41:53.000Z","dependencies_parsed_at":"2024-03-31T14:46:23.416Z","dependency_job_id":null,"html_url":"https://github.com/commercelayer/sanity-commerce","commit_stats":null,"previous_names":["commercelayer/sanity-commerce"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercelayer%2Fsanity-commerce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercelayer%2Fsanity-commerce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercelayer%2Fsanity-commerce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercelayer%2Fsanity-commerce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercelayer","download_url":"https://codeload.github.com/commercelayer/sanity-commerce/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125106,"owners_count":21051759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T13:08:40.982Z","updated_at":"2025-04-09T22:43:10.082Z","avatar_url":"https://github.com/commercelayer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sanity Commerce by Commerce Layer\n\n![Sanity Commerce by Commerce Layer](/assets//header.png#gh-light-mode-only)\n![Sanity Commerce by Commerce Layer](/assets//header-dark.png#gh-dark-mode-only)\n\n\u003e This is a **Sanity Studio v3** plugin.\n\n## Introduction\n\nTraditionally, product catalogs and commerce engines are closely tied together, often leading to complex management and limited flexibility in content presentation. This plugin proposes a paradigm shift by decoupling the product catalog from the commerce engine. It enables you to manage your product catalog within Sanity CMS, while platforms like Commerce Layer handle the transactional aspects. This approach offers enhanced content management capabilities, improved editorial workflows, and a richer user experience.\n\n## Features\n\nThe Sanity Commerce Plugin is designed to seamlessly integrate ecommerce functionality into Sanity CMS. Focused on simplifying content management for ecommerce platforms, this plugin allows you to manage your product catalog directly within Sanity, leveraging the power and flexibility of headless commerce.\n\n- Spin up a content model to handle products within Sanity.\n- Customizable schema for products, variants, taxonomies, and taxons.\n- Flexible configuration options to adapt to different ecommerce needs.\n- Streamlined management of product details, variants, and categorizations.\n\n## Installation\n\n```sh\nnpm install @commercelayer/sanity-plugin-commerce\n```\n\n## Usage\n\nConfigure the plugin in your `sanity.config.ts` file. Here’s an example configuration:\n\n```typescript\nimport { defineConfig } from 'sanity';\nimport {\n  sanityCommerce,\n  SanityCommercePluginConfig,\n} from '@commercelayer/sanity-plugin-commerce';\n\nconst sanityCommerceConfig: SanityCommercePluginConfig = {\n  // ...configure the plugin here.\n};\n\nexport default defineConfig({\n  // ... other config settings.\n  plugins: [sanityCommerce(sanityCommerceConfig)],\n});\n```\n\n## Core Concepts\n\n- Catalog: A catalog is a collection of products, often tailored for different markets or seasons. It acts as a container for your product offerings, allowing for organization and easy management within a specific context.\n- Taxonomy: A taxonomy is a hierarchical system for classifying and organizing content. It is used to group products into broad categories, such as 'Clothing' or 'Electronics', which can then be broken down into more specific subcategories.\n- Taxon: A taxon is an individual category within a taxonomy. Taxons can be nested, allowing you to create a detailed structure for product classification.\n- Product: A product represents an individual item for sale. It is the core of your e-commerce catalog and can be associated with multiple variants.\n- Variant: A variant is a specific version of a product, which might differ in size, color, or other attributes. Each variant is a unique combination of these attributes and is typically associated with a unique SKU.\n\n## Relationships and Hierarchy\n\n- Products are linked to Variants, which define the different purchasable versions of a product.\n- Taxonomies organize Taxons into a hierarchical structure, providing a framework for - categorizing products.\n- Catalogs group products and their related taxonomies to present a curated collection to the end-user.\n\n### Configuration Options\n\nFor product and variant attributes, there are some fields already preconfigured. Using field names that already exist will **override** the default content model. It is highly recommended to check the result of the content model before adding custom extensions.\n\nThe Sanity Commerce Plugin offers flexible configuration to adapt to your specific e-commerce needs. Below is a table summarizing the configuration options:\n\n| Option              | Type                | Description                                                | Example                                      |\n| ------------------- | ------------------- | ---------------------------------------------------------- | -------------------------------------------- |\n| `productLabel`      | `string`            | Sets the display name for products in the CMS.             | `'Coffee'`                                   |\n| `variantLabel`      | `string`            | Sets the display name for product variants.                | `'Coffee Variant'`                           |\n| `taxonomyLabel`     | `string`            | Sets the display name for taxonomies.                      | `'Category System'`                          |\n| `taxonLabel`        | `string`            | Sets the display name for individual taxons or categories. | `'Category'`                                 |\n| `productAttributes` | `FieldDefinition[]` | An array of additional field definitions for the product.  | `[ { name: 'origin', type: 'string' } ]`     |\n| `variantAttributes` | `FieldDefinition[]` | An array of additional field definitions for the variant.  | `[ { name: 'roastLevel', type: 'string' } ]` |\n\n#### Example Configuration\n\nHere is a full example of how you might configure the plugin in your `sanity.config.ts`:\n\n```typescript\nimport { defineConfig } from 'sanity';\nimport { sanityCommerce } from 'sanity-plugin-commerce';\n\nconst sanityCommerceConfig = {\n  productLabel: 'Coffee',\n  variantLabel: 'Coffee Variant',\n  taxonomyLabel: 'Category System',\n  taxonLabel: 'Category',\n  productAttributes: [{ name: 'origin', title: 'Origin', type: 'string' }],\n  variantAttributes: [\n    {\n      name: 'roastLevel',\n      title: 'Roast Level',\n      type: 'string',\n      options: {\n        list: [\n          { title: 'Light', value: 'light' },\n          { title: 'Medium', value: 'medium' },\n          { title: 'Dark', value: 'dark' },\n        ],\n      },\n    },\n  ],\n};\n\nexport default defineConfig({\n  plugins: [sanityCommerce(sanityCommerceConfig)],\n});\n```\n\nThis configuration allows you to tailor the plugin to best fit your product catalog and editorial workflow.\n\n## Develop \u0026 test\n\nThis plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)\nwith default configuration for build \u0026 watch scripts.\n\nSee [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)\non how to run this plugin with hotreload in the studio.\n\n## License\n\nThis plugin is released under the [MIT License](LICENSE) © Commerce Layer.\n\n### Release new version\n\nRun [\"CI \u0026 Release\" workflow](TODO/actions/workflows/main.yml).\nMake sure to select the main branch and check \"Release new version\".\n\nSemantic release will only release on configured branches, so it is safe to run release on any branch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercelayer%2Fsanity-commerce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercelayer%2Fsanity-commerce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercelayer%2Fsanity-commerce/lists"}