The Store Locator list can be sorted by a number of attributes, such as ID, title, city, state, distance, and the categories. Moreover, the default sorting is by the distance to the center of the searched location.

To change the sorting, please go to “ASL Setting” in the WordPress admin panel under the “Store Locator” section, select the required sorting parameter, and save the settings.

Store Attribute List
Store Attribute List

How to sort by shortcode attribute? #

In order to sort by the shortcode attribute, you have to provide the sort_by attribute in the shortcode as an attribute with the value to sort, the empty value will be considered as distance.

[ASL_STORELOCATOR sort_by=""]

Other possible values for the above attributes are title, city, state, country, or any other custom column.

Can we change the sorting to distance after the search is performed? #

If your initial sorting is set to another attribute than the distance and you want to set it to distance after the search is performed, add the following shortcode attribute.

[ASL_STORELOCATOR search_dist_sort="1"]

The above shortcode will switch the sort to distance, once a search or geolocation is performed.

Can we change the sorting after the first load? #

Yes, it can be done via the JS hooks, once the store locator is loaded you can change the sorting value.

How to sort by the Categories? #

Category sorting is multi-level sorting that works by sorting by the categories and the distance as well. Furthermore, to add this sorting, please use the shortcode below.

[ASL_STORELOCATOR sort_by="cat"]

How to Sort the Categories List? #

The categories listed in the store locator are sorted in alphabetical order by default. To change the sorting order by other attributes such as the order ID can be done via the shortcode below.

[ASL_STORELOCATOR cat_sort="ordr"]

How to Sort the Dropdowns List? #

Agile Store Locator offers additional dropdowns such as brand and special, all those dropdowns have an order column that can be utilized to sort the list based on whatever order you want, to apply that sorting, you will be required to add filter_sort attribute, as given in the example below.

[ASL_STORELOCATOR filter_sort="ordr"]