This guide provides a step-by-step walkthrough for adding a MapCosmos store locator widget to your Shopware storefront.
👉 If you haven’t created a widget yet, follow our setup guide first.
Since Shopware templates are Twig-based, you’ll insert the MapCosmos snippet into a CMS page or theme template.
1. Go to Content → Shopping Experiences in your Shopware admin.
2. Create a new Layout (or edit an existing one).
3.
4. Add a Custom HTML element to the section where you want the locator.
5. Paste the MapCosmos snippet into the HTML field and delta the sample text.
6. Click Save → Assign layout to page → View in storefront to see the real output.
If you prefer a dedicated page for the locator:
Inside it, paste:
{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_content %}
<h1>Find a Store</h1>
<script type="text/javascript" src="https://widget.mapcosmos.com/map-widget.js?key=WIDGET_KEY" async></script>
<div id="map-cosmos-map-widget"></div>
{% endblock %}
Clear the cache and recompile theme:
bin/console cache:clear
bin/console theme:compile
âś… Search instantly for nearby locations
âś… Get directions with one click (Google/Apple Maps)
âś… Filter results by category, product, or service
âś… Access opening hours, parking, and accessibility details
âś… Download PDFs like catalogs or menus directly
🚀 Start with MapCosmos free today and add a powerful, responsive store locator to your Shopware storefront in minutes.