npm.io
2.22.7 • Published 4d ago

@medusajs/store

Licence
MIT
Version
2.22.7
Deps
0
Size
59 kB
Vulns
0
Weekly
0
Stars
36.5K

Medusa logo

@medusajs/store

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

Store Module for Medusa: manages stores and their supported currencies and locales. It's installed and registered by default with @medusajs/medusa, so Medusa applications use it through the Modules.STORE service rather than installing this package directly.

At a glance

Package @medusajs/store
Type Commerce Module
Module key Modules.STORE ("store")
Registered by default Yes
Import from @medusajs/medusa/store

Installation

No installation needed. The module ships with @medusajs/medusa and is registered by defineConfig.

Usage

Resolve the module's service from the Medusa container, for example in a workflow step:

import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { Modules } from "@medusajs/framework/utils"

const createStoreStep = createStep(
  "create-store",
  async ({}, { container }) => {
    const storeModuleService = container.resolve(Modules.STORE)

    const store = await storeModuleService.createStores({
      name: "My Store",
      supported_currencies: [{
        currency_code: "usd",
        is_default: true,
      }],
    })

    return new StepResponse({ store }, store.id)
  }
)

Resources