In the modern world of e-commerce your website is no longer the only point of sale for your goods.
Channel model represents a single sales channel, which can be one of the following things:
- Mobile application
- Cashier in your physical store
Or pretty much any other channel type you can imagine.
What may differ between channels? Particularly anything from your shop configuration:
- locales (language),
- payment and shipping methods.
A Channel has a
name and a
In order to make the system more convenient for the administrator - there is just one, shared admin panel. Also users are shared among the channels.
In the dev environment you can easily check what channel you are currently on in the Symfony debug toolbar.
How to get the current channel?
You can get the current channel from the channel context.
$channel = $this->container->get('sylius.context.channel')->getChannel();
Beware! When using multiple channels, remember to configure
hostname for each of them.
If missing, default context would not be able to provide appropriate channel and it will result in an error.
The channel is by default determined basing on the hostname, but you can customize that behaviour.
To do that you have to implement the
and register it as a service under the
sylius.context.channel tag. Optionally you can add a
since the default ChannelContext has a
priority="-128", and by default a
priority="0" is assigned.
Moreover if the channel depends mainly on the request you can implement the
findChannel(Request $request) method and register it under the
Shop Billing Data¶
Sylius Plus is supplied with an enhanced version of Shop Billing Data from open source edition. It is also used for Invoicing and Refunds purposes, but it is a separate entity, that you can create outside of the Channel and then just pick a previously created Business Unit on the Channel form.