Search code examples
themesshopwareshopware6

How Do I Get Config Variables on Shopware 6 Theme To The Storefront


I am building my own Shopware 6 theme using another Shopware 6 theme as a guide. I noticed the theme developer was able to bring the config.xml variables to the storefront. I discovered this by using the {{ dump() }} twig function. How do I do the same for my theme?

Attached is a picture of what I saw.

ssik is the name of the twig variable/array and config as seen in the picture


Solution

  • In twig templates there are a couple of functions you can use to get config values.

    config.xml setting values:

    {{ config('MyPlugin.config.nameOfConfigSetting') }}
    

    theme.json config setting values:

    {{ theme_config('name-of-theme-setting') }}