How it works

How to add

If you have a newer Shopify theme compatible with app blocks (any public theme version after March 2023), you can add the Geolocation Button app block directly to your header or footer using section groups.

To add the Geolocation Button, go to the Shopify Theme Editor, navigate to your desired section (header or footer), and insert the app block directly.

However, many themes are not compatible with adding app blocks in a section that appears in all your theme pages (like the header or the footer sections).

If that is your case, follow this tutorial:

Update your theme to be compatible with App Blocks

Here’s how to do it:

  1. Edit your theme: Go to Online Store > Themes > Edit code in your Shopify admin.

  2. Check your sections folder. Look for a section in this folder called apps.liquid. If it does not exist, create the file and insert this code:

    <div>
      {%- for block in section.blocks -%}
        {% render block %}
      {%- endfor -%}
    </div>
    
    {% schema %}
    {
      "name": "Apps",
      "tag": "section",
      "blocks": [
        {
          "type": "@app"
        }
      ],
      "presets": [
        {
          "name": "Apps"
        }
      ]
    }
    {% endschema %}
    
  3. Create a new file. Insert a new file in the sections folder with the name: app-group.json. And insert this code:

    {
      "type": "aside",
      "name": "Apps",
      "sections": {
        "main": {
          "type": "apps",
          "settings": {
          }
        }
      },
      "order": [
        "main"
      ]
    }
  4. Edit theme.liquid. Go the theme.liquid file and insert this after closing the <body> tag or after the section header / section footer.

    {% sections 'app-group' %}
  5. Theme Editor. Click on "Customize" your theme, and you will see a new section called Apps only for adding app blocks to your installed apps.

How to setup

Enable the correct App Embed

The Geolocation Button can open either the Geolocation Popup or the Market Selector modal.

To ensure the Geolocation Button works properly, you need to enable the correct app embed based on your selected option. Otherwise, the button will not function as expected. Follow these steps to set it up:

  • If you choose the Geolocation Popup, make sure the Geolocation Popup app embed is enabled.

  • If you select the Market Selector modal, ensure the Market Selector app embed is enabled with the Modal option selected.

This setup is essential for the button to display the correct selector when clicked.

Learn more about

Last updated