Display Default Search when Store Locator Loads

Created by Brett Mikulik, Modified on Mon, 07 Nov 2022 at 04:06 PM by Brett Mikulik

Overview

Store Locator will display a general map of your region. If you have a main store or headquarters, the map can be adjusted to make a specific location the default to where your map loads.

To display a default search when Store Locator loads, please follow the steps below.


Setup

  1. From the Shopify admin, select Apps.
  2. Select Store Locator.
  3. Select Settings.

    select settings

  4. Select Display Settings.

    select display settings

  5. Copy and paste this code into the Page Header HTML field:
    <script>
    document.addEventListener("DOMContentLoaded", function(){
    document.getElementById('address_search').value = "!!!";
    setTimeout(function(){
    document.querySelector('.search_bar button').click();
    }, 1000);
    });
    </script>

  6. Replace !!!! with the search term you'd like as the default search.

    SL change the S

  7. Select Save

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article