Skip to main content
Channels represent different sales platforms where your products can be sold. Examples include your main website, mobile app, marketplace integrations, or physical stores.

Model

The model used is Shopper\Core\Models\Channel. It implements Shopper\Core\Models\Contracts\Channel and uses the HasSlug trait for automatic slug generation. The model is configurable via config/shopper/models.php.

Extending the Model

To add custom behavior, extend the model and update your configuration:
Update config/shopper/models.php:

Database Schema

Relationships

Products

Channels have a many-to-many polymorphic relationship with products:

Query Scopes

Observer Behavior

The ChannelObserver ensures only one channel can be default:

Default Channel

You can retrieve the default channel using the default scope:

Creating Channels

Default Website Channel

Additional Channels

Retrieving Channels

Assigning Products to Channels

Storefront Example

Multi-Channel API

Use Cases

Best Practices

  1. Default Channel: Always have one default channel for fallback
  2. Product Assignment: Assign products to relevant channels during creation
  3. Timezone: Set appropriate timezone for each channel
  4. Metadata: Use metadata for channel-specific configuration (API keys, etc.)