newgennerd
newgennerd

Reputation: 1078

How to get the current saleschannel domain in Shopware 6 storefront/TWIG?

I want to get full current domain configured for the saleschannel of the current request.
Because Shopware also allows directory-URLs as saleschannel domain (e.g. https://www.example.com/de), it is not safe to just use the host from the request for example.

Upvotes: 2

Views: 1717

Answers (1)

newgennerd
newgennerd

Reputation: 1078

After some digging around, I found that you can use app.request.get('sw-storefront-url') in your TWIG template. This information is of course not only available in TWIG context, you can use it everywhere you have access to the request.

Upvotes: 4

Related Questions