Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Company Switcher Quick Start

Get started with the Company Switcher drop-in to enable multi-company context switching for B2B users.

Version: 1.0.6-beta5

Quick example

The Company Switcher drop-in is included in the Commerce boilerplate . This example shows the basic pattern:

// 1. Import initializer (handles all setup)
import '../../scripts/initializers/company-switcher.js';
// 2. Import the container you need
import CompanySwitcher from '@dropins/storefront-company-switcher/containers/CompanySwitcher.js';
// 3. Import the provider
import { render as provider } from '@dropins/storefront-company-switcher/render.js';
// 4. Render in your block
export default async function decorate(block) {
await provider.render(CompanySwitcher, {
// Configuration options - see Containers page
})(block);
}

New to drop-ins? See the Using drop-ins guide for complete step-by-step instructions.

Quick reference

Import paths:

  • Initializer: import '../../scripts/initializers/company-switcher.js'
  • Containers: import ContainerName from '@dropins/storefront-company-switcher/containers/ContainerName.js'
  • Provider: import { render } from '@dropins/storefront-company-switcher/render.js'

Package: @dropins/storefront-company-switcher

Version: 1.0.6-beta5 (verify compatibility with your Commerce instance)

Example container: CompanySwitcher

Learn more

  • Containers - Available UI components and configuration options
  • Initialization - Customize initializer settings and data models
  • Functions - Control drop-in behavior programmatically
  • Events - Listen to and respond to drop-in state changes
  • Slots - Extend containers with custom content