@zachariaz/strapi-plugin-store-scope
v0.1.1
Published
Strapi plugin for multi-store content scoping with configurable hierarchy
Maintainers
Readme
strapi-plugin-store-scope
A Strapi v5 plugin that adds multi-level content scoping to the Content Manager. Editors switch between store/region/channel/location-specific versions of the same document the way they switch between i18n locales today. The scope hierarchy is configurable per project.
Note on package name: this package is temporarily published under
@zachariaz/...so it can be installed while the official@solteq/strapi-plugin-store-scopescope is being set up. The API will not change when it moves.
How it works
- The plugin creates an internal
plugin::store-scope.scope-assignmentcollection that records which document belongs to which scope. - It registers a Document Service middleware that filters configured content types by a
?storeScope=<id>query param. Resolution is most-specific-wins: a request for a channel-level scope falls through to its region, then store, then global/unscoped if no assignment exists at the more specific level. - In the admin it adds a header dropdown, an edit-view side panel, and a list-view "Available in" column so editors can see and navigate between scoped variants.
Install
In your Strapi project:
npm install @zachariaz/strapi-plugin-store-scopeEnable in config/plugins.ts (or .js):
export default {
'store-scope': {
enabled: true,
config: {
enabledLevels: ['store', 'channel'],
scopedContentTypes: [
'api::product.product',
'api::promotion.promotion',
],
},
},
};Restart Strapi. "Store Scope" appears in Settings, and the scope dropdown/panel show up on the configured content types in the Content Manager.
Configuration
enabledLevels: ('store' | 'region' | 'channel' | 'location')[]— which scope tiers participate in the hierarchy. Default:['store', 'channel'].scopedContentTypes: string[]— content type UIDs that should be filtered by?storeScope=. Only listed types are intercepted. Default:[](nothing scoped).
Requirements
- Strapi v5.
- The consuming Strapi app must already define content types matching each enabled level:
'store'→api::store.store'region'→api::region.region'channel'→api::sales-channel.sales-channel'location'→api::stock-location.stock-location
These typically come from a Medusa sync, but the plugin itself is provider-agnostic — any content types with those UIDs work.
Querying scoped content from a storefront
Pass the scope identifier as a query param. The plugin filters the response to documents assigned to that scope (or inherited from a parent scope per the hierarchy).
GET /api/products?storeScope=<store-or-channel-id>Omitting storeScope returns global/unscoped documents.
License
MIT
