How to integrate ReviewForest widgets in Shopware 6
Every ReviewForest widget goes into your Shopware 6 store (version 6.7) the same way. First create the widget in the ReviewForest dashboard and copy its code, as described in Install a ReviewForest widget.
Your widget code
Section titled “Your widget code”The code has two lines, and you always copy both into your store together:
- The script loads the widget from our servers.
- The placeholder (div) marks the spot where the widget appears. The letters and numbers at its end identify your widget.
<script src="https://widgets.reviewforest.org/main.js" defer></script><div class="reviewforest-app-YOUR-WIDGET-ID"></div>Add the widget with Shopping Experiences
Section titled “Add the widget with Shopping Experiences”This is the easiest way to place a widget on your home page or on a category page.
-
In your Shopware admin, go to Content → Shopping Experiences and open the layout of your page.
-
Click the plus icon (+) to add a block, choose the HTML category and drag the HTML block to the spot where the widget should appear.
-
Paste your complete widget code (script and div) into the block.
-
Click Save in the top right, then reload your store in the browser.
Shopware warns that unfiltered HTML can be a security risk. That’s what this block is for: paste only code you trust, such as the code from your ReviewForest dashboard.
What to watch out for
Section titled “What to watch out for”Security rules (CSP)
Section titled “Security rules (CSP)”If your store sends its own Content Security Policy and the widget doesn’t appear, ask your technical team to allow https://widgets.reviewforest.org for scripts (script-src) and https://api.reviewforest.org and https://cdn.comvi.io for data (connect-src). These are the basics: the review forest widget also loads a map from Mapbox and adds its own styles, so it may need more. Shopware doesn’t send such a policy by default.
Data protection
Section titled “Data protection”Whether you need to add the widget to your cookie consent tool depends on your setup. What our widgets load and store is described in Widgets & GDPR.
Floating badge and scroll-up button
Section titled “Floating badge and scroll-up button”Shopware’s scroll-up button sits in the bottom right corner. Set a floating badge to Bottom left in your ReviewForest dashboard so the two don’t overlap.
Mobile view
Section titled “Mobile view”Our widgets adjust to the space they get. If one looks squeezed on a phone, the element around it is too narrow.
Show the widget on every page with your theme
Section titled “Show the widget on every page with your theme”If you want your ReviewForest widget to appear on every page of your store (at the bottom, above the legal notice or the payment methods), add it to your design code (theme).
Prerequisite: You need access to your store’s files (via FTP or through your agency) and your own theme (don’t change Shopware’s “Default” theme directly).
Step 1: Find the right file
Section titled “Step 1: Find the right file”Navigate to the following path in your theme:
YOUR_THEME/src/Resources/views/storefront/layout/footer/footer.html.twig
If the file doesn’t exist yet, create it. It extends Shopware’s default footer.
Step 2: Insert the code
Section titled “Step 2: Insert the code”If you just created the file, copy the following block into it. If the file already existed, add only the lines from <div class="container"> to the matching </div> inside its existing layout_footer_navigation block. Otherwise the file declares the same block twice, and Shopware can’t compile the template. In both cases, replace YOUR-WIDGET-ID with the ID of your widget, the part after reviewforest-app- in your code. The rest of the footer stays as it is:
{% sw_extends '@Storefront/storefront/layout/footer/footer.html.twig' %}
{% block layout_footer_navigation %} {# The original footer content is preserved #} {{ parent() }}
{# This is where we embed your ReviewForest widget #} <div class="container"> <script src="https://widgets.reviewforest.org/main.js" defer></script> <div class="reviewforest-app-YOUR-WIDGET-ID" style="margin-top: 20px; text-align: center;"></div> </div>{% endblock %}Step 3: Clear the cache
Section titled “Step 3: Clear the cache”For Shopware to notice the change, clear the cache, either in the admin under Settings → System → Caches & indexes with Clear cache, or in the console (terminal):
bin/console cache:clear
If you created the theme just now, install it, assign it to your sales channel and compile it once with bin/console theme:compile.
What your technical team needs to know (short facts)
Section titled “What your technical team needs to know (short facts)”If you’d rather not do this yourself, copy this part into an email to your agency:
- Goal: Embed the global ReviewForest widget in Shopware 6.7.x.
- Integration: Via a child theme in
footer.html.twig, ideally in thelayout_footer_navigationorlayout_footer_bottomblock. For a floating badge, the empty blockbase_body_scriptinbase.html.twig, right before</body>, works too. - Important (CSP): If the shop sends a Content Security Policy,
https://widgets.reviewforest.orgmust be allowed forscript-src, andhttps://api.reviewforest.organdhttps://cdn.comvi.ioforconnect-src. The review forest widget additionally loads a Mapbox map and injects its own styles. - Performance: The script loads with
defer, so it doesn’t block the page from rendering.