Custom CSS & Custom JavaScript
Description
Highlights
About the Extension
Custom CSS and custom JavaScript in containers
Add CSS and JS gives you the page "CSS/JS Container" under Extensions > Add CSS/JS. There you collect your code in containers: each one has a name, a code field "CSS/SCSS", a code field "JavaScript" and the checkbox "Active", and only active containers reach the storefront.
- A container without a selected sales channel applies to all of them, and the list shows "all"
- Choose sales channels to limit a container to them
- The list shows the name, status, sales channels and page restriction of your containers
- Several active containers are combined in alphabetical order of their names
How custom CSS becomes part of your theme
During a theme compilation, the custom CSS of the active containers is appended after the styles of your theme and compiled together with its SCSS. So you can write SCSS and use the variables of your theme.
- "Add SCSS Variable" inserts one of 135 theme variables, such as $primary, $border-radius or $font-family-base, at the cursor
- A colour picker inserts a hex code at the cursor
- "Save & Compile" saves the container and compiles the themes of your sales channels, while changes saved with "Save" alone reach the storefront with the next theme compilation
- Deleting a container in the list compiles the themes again as well
Custom JavaScript with bundled libraries
The custom JavaScript of the active containers is written to a script file of its own in the theme during compilation, and the storefront loads it together with the theme.
- Both code fields use a code editor with syntax highlighting for CSS and JavaScript
- "Add JavaScript Library" puts a library line, for example library(jquery);, at the top of your code
- On compile, this line is replaced with the bundled library, which is placed once at the start of the script file, outside the consent and page checks
- You can choose from Cesium JS, D3, Dojo, Ext Core, Hammer JS, jQuery, List JS and Model Viewer
Limit custom CSS and custom JavaScript to selected pages
In the card "Page restriction", you choose under "Delivery": "On all pages" (default), "Only on selected pages" or "On all pages except the selected ones". A page counts as selected as soon as one criterion matches:
- Page types, 17 in total, such as home page, category listing, product detail page, search results, cart and account pages
- URLs with * as a wildcard, for example /campaign/* or *sale*
- Detail pages of selected products (a parent product also covers its variants), listing pages of selected categories with their subcategories (can be switched off, on by default) and landing pages
- Restricted CSS applies through a class on the body element (top-level @font-face, @keyframes and @include blocks stay global), and restricted JavaScript only runs on matching pages
- New criteria take effect right away, while a new delivery mode needs a theme compilation
Custom JavaScript only after cookie consent
In the card "Cookie consent", you can enter a "Required cookie". The custom JavaScript of the container then only runs once this cookie exists with a value, and it can start right after consent is given, without a page reload.
- Optional: "Register in cookie consent manager" lists the container under its name as an entry of its own in the group "Custom content" of the storefront cookie consent manager
- On acceptance, the cookie is set to 1 for 30 days
- Without this option, the JavaScript only runs if another tool sets the cookie with a value (at the latest on the next page load)
- The custom CSS of a container is not bound to the consent and always loads
Version history for custom CSS and custom JavaScript
When you save changes to a container, its state is stored with date, name and user in the card "Version history". The latest 20 versions are kept per container.
- "Restore" loads a version into the fields, and it reaches the storefront once you save and compile
- A version covers the name, the code, the status, the page restriction and the cookie settings, but not the sales channels
- States saved without a user, for example by an integration through the API, appear as "Unknown"
Permissions for custom CSS and custom JavaScript
The permission "Add CSS/JS" has the levels View, Edit, Create and Delete in the role settings.
- View: browse containers and their version history
- Edit: change containers and restore versions
- Create: add new containers (includes Edit)
- Delete: remove containers in the list
Details
- Available: English, German
- Latest update: 18 November 2026
- Publication date: 20 August 2024
- Version: 2.1.0
- Category: Special features
Resources
Reviews (3)
Super Plugin
Einfacher geht nicht
Super Plugin
About the Extension Partner
weedesign
Partner Status
-
Shopware
Extension Partner
Details
- Ø-Rating: 4.9
- Partner since: 2019
- Extensions: 71
Support
- Based in: Germany
- Speaks: German, English
- Response time: Very quickly