image of logo

How to Add a Store Locator to Shopware

This guide provides a step-by-step walkthrough for adding a MapCosmos store locator widget to your Shopware storefront.

Step 1: Get your installation code

  1. Log in to your MapCosmos dashboard
  2. Open your widget
  3. Click Installation Code
  4. Copy the snippet provided
👉 If you haven’t created a widget yet, follow our setup guide first.

Step 2: Embed the locator into Shopware

Since Shopware templates are Twig-based, you’ll insert the MapCosmos snippet into a CMS page or theme template.

Option A: Add to a Shopping Experience (CMS Page)

1. Go to Content → Shopping Experiences in your Shopware admin.

Screenshot of Shopware admin showing how to add a MapCosmos store locator to a Shopping Experience CMS page by creating or editing a layout.

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.

Adding a Custom HTML element in Shopware layout to embed MapCosmos store locator.

5. Paste the MapCosmos snippet into the HTML field and delta the sample text.

Pasting MapCosmos store locator code into Shopware HTML field and previewing it in the storefront.

6. Click Save → Assign layout to page → View in storefront to see the real output.

Option B: Add to a Theme Template

If you prefer a dedicated page for the locator:

  1. Create a new CMS page called Store Locator
  2. Assign your Shopping Experience layout to it
  3. In your theme files, create/edit a template like:
    custom/plugins/YourTheme/src/Resources/views/store-locator.html.twig

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

Step 3: Publish and test

  • Assign the new page to your navigation (e.g., “Find Us” or “Store Locator”).
  • Refresh the storefront.
  • Verify that the widget renders and loads correctly.

What your customers can do

âś… 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.

See all integrations

Other platforms

Interested in MapCosmos?
The first 7 days are on us
Free hands on boarding & support
No credit card required!

Interested in MapCosmos? See it in action!

The first 7 days are on us
Free hands on boarding & support
No credit card required!
Interested in MapCosmos?
The first 7 days are on us
Free hands on boarding & support
No credit card required!