Getting Store Details
In Slerp most key settings are kept at a store level. A store represents a single trading location so can be either a "store" or a site the user trades from.
All Stores
To fetch key details for all stores you can access them with a query like this:
Note: the use of the where clause: {archived_at: {_is_null: true}}
allows us to not return archived stores. If, for example you wanted to return only open stores you could add something like: is_open: {_eq: true}
to the clause (separated by comma).
query getLocations($slug: String!) {
stores(where: {archived_at: {_is_null: true}, merchant: {slug: {_eq: $slug}}}) {
id
name
slug
is_open
address {
line_1
line_2
city
zip
geom
}
archived_at
cutoffs
special_cutoffs
operating_schedules
special_schedules
settings
split_hours
pre_order_settings {
cutoffs
delivery_courier_partner
delivery_enabled
delivery_interval
delivery_radius
delivery_schedule
delivery_times
delivery_zone
fixed_courier_fee_enabled
fixed_delivery_times_enabled
fixed_delivery_times_order_limit
delivery_timeslots_order_limit
pre_order_day_allowance
pickup_times
pickup_schedule
pickup_interval
pickup_enabled
pickup_timeslots_order_limit
special_cutoffs_map
delivery_area_setting
}
}
}
Key Fields:
- ID: The Store ID, this will be used for creating a cart using this store or accessing available products from the store
- Settings: Many settings are covered on a store level, this has it's own page further on in the documentation
- schedules: This returns the stores opening hours. Remember we have a specific
getValidStores
query to find stores open and valid depending on timeslot, you do not need to calculate these yourself. - Pre_order_settings.pre_order_day_allowance: How many days in advance will a store allow orders to be taken
- Address: This contains the key elements of store address.
- is_open: Boolean returns true if store is open
Sample Response:
{
"data": {
"stores": [
{
"id": "7fac98ba-2ff5-4e53-af9f-38c480e730e7",
"name": "test store please ignore",
"slug": "origin-coffee-test-store-please-ignore",
"is_open": true,
"address": {
"line_1": "",
"line_2": "137 Lordship Lane",
"city": "London",
"zip": "SE22 8HX",
"geom": {
"type": "Point",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::4326"
}
},
"coordinates": [
51.4564981,
-0.0756727
]
}
},
"archived_at": null,
"cutoffs": null,
"special_cutoffs": null,
"operating_schedules": {
"id": "40c3d990-806f-4f6e-b66e-6e67041cb409",
"friday": {
"id": "af1819e3-02e8-4055-9686-cfd819017009",
"end": "14:00:00",
"start": "11:00:00",
"enabled": true,
"special_date": null
},
"monday": {
"id": "6eee2562-5b6e-460e-af4b-d0bc10575029",
"end": "22:00:00",
"start": "11:00:00",
"enabled": true,
"special_date": null
},
"sunday": {
"id": "941acca0-49ba-4784-b97c-e32027889b4c",
"end": null,
"start": null,
"enabled": false,
"special_date": null
},
"tuesday": {
"id": "32c4ad7a-a3fa-4643-ba06-481da4ba9c49",
"end": null,
"start": null,
"enabled": false,
"special_date": null
},
"saturday": {
"id": "4857ab2b-7bb3-4c87-8199-7851c47ed38f",
"end": null,
"start": null,
"enabled": false,
"special_date": null
},
"thursday": {
"id": "b66eb741-6723-4188-9d12-fb3cc0942ee2",
"end": "15:00:00",
"start": "08:00:00",
"enabled": true,
"special_date": null
},
"wednesday": {
"id": "3d23a416-6084-4e38-900c-252b66154dc1",
"end": null,
"start": null,
"enabled": false,
"special_date": null
}
},
"special_schedules": [
{
"id": "64b00404-3353-4b8a-a598-7f6e3bb91306",
"end": null,
"start": null,
"enabled": false,
"special_date": "2022-12-22"
}
],
"settings": {
"id": "eca0c689-c4d3-4219-92d4-aab53d845d47",
"timezone": "Europe/London",
"asap_only": false,
"prep_mode": "moderate",
"table_count": 0,
"asap_enabled": true,
"delivery_area": [
{
"lat": 51.572440128985505,
"lng": -0.0756727
},
{
"lat": 51.53848149492018,
"lng": 0.05550073187228706
},
{
"lat": 51.4564981,
"lng": 0.1098345463768116
},
{
"lat": 51.37451470507982,
"lng": 0.05550073187228709
},
{
"lat": 51.34055607101449,
"lng": -0.07567269999999997
},
{
"lat": 51.37451470507982,
"lng": -0.20684613187228706
},
{
"lat": 51.4564981,
"lng": -0.2611799463768116
},
{
"lat": 51.53848149492018,
"lng": -0.20684613187228712
}
],
"table_choices": "",
"table_enabled": false,
"additional_fee": null,
"delivery_radius": 1,
"pickup_interval": 15,
"same_day_pickup": false,
"tip_percentages": [
5,
12.5,
20,
0
],
"is_3pl_fulfilled": false,
"pre_order_pickup": false,
"preparation_time": null,
"scheduled_pickup": false,
"delivery_interval": 30,
"same_day_delivery": true,
"busy_delivery_area": [
{
"lat": 51.537657520289855,
"lng": -0.0756727
},
{
"lat": 51.51388647644412,
"lng": 0.01614870231060095
},
{
"lat": 51.4564981,
"lng": 0.05418237246376813
},
{
"lat": 51.399109723555874,
"lng": 0.016148702310600976
},
{
"lat": 51.37533867971014,
"lng": -0.07567269999999998
},
{
"lat": 51.399109723555874,
"lng": -0.16749410231060094
},
{
"lat": 51.4564981,
"lng": -0.20552777246376813
},
{
"lat": 51.51388647644412,
"lng": -0.16749410231060097
}
],
"deliverect_link_id": null,
"fixed_delivery_fee": 0,
"pre_order_delivery": false,
"scheduled_delivery": true,
"delivery_validation": "strict",
"minimum_order_value": 0,
"oat_tipping_enabled": false,
"table_counter_pickup": false,
"busy_preparation_time": 60,
"delivery_area_enabled": false,
"stock_control_enabled": false,
"table_welcome_message": "",
"pickup_tipping_enabled": false,
"quiet_preparation_time": 60,
"advanced_order_interval": null,
"automatically_open_store": true,
"delivery_tipping_enabled": false,
"is_delivering_nationwide": false,
"automatically_close_store": false,
"moderate_preparation_time": 60,
"busy_delivery_area_enabled": false,
"pickup_timeslot_order_limit": 0,
"same_day_rate_cards_enabled": false,
"table_counter_pickup_message": "",
"delivery_timeslot_order_limit": 0,
"enable_advanced_order_timeslots": false,
"same_day_delivery_courier_partner": false,
"advanced_timeslots_delivery_interval": 60,
"same_day_delivery_courier_custom_fixed_fee": 0,
"same_day_delivery_fixed_courier_fee_enabled": true
},
"split_hours": [
{
"id": "65bb34b3-97cf-4c80-bdda-2e631a12f50f",
"closed": false,
"enabled": false,
"start_time": null,
"day_of_week": "monday",
"special_date": null,
"seconds_length": null
},
{
"id": "5098af39-9189-44a9-b096-930386beef28",
"closed": false,
"enabled": false,
"start_time": null,
"day_of_week": "tuesday",
"special_date": null,
"seconds_length": null
},
{
"id": "a3a8d8f5-8dac-4246-8544-baf6f7b30a2f",
"closed": false,
"enabled": false,
"start_time": null,
"day_of_week": "wednesday",
"special_date": null,
"seconds_length": null
},
{
"id": "278a06c0-9ab5-4b2c-b434-8b4786c3995a",
"closed": false,
"enabled": false,
"start_time": null,
"day_of_week": "thursday",
"special_date": null,
"seconds_length": null
},
{
"id": "732893d0-668a-41f1-a531-d6f7cbf623ef",
"closed": false,
"enabled": false,
"start_time": null,
"day_of_week": "friday",
"special_date": null,
"seconds_length": null
},
{
"id": "5490a899-8ff1-4c26-89f3-e0996dc2a254",
"closed": false,
"enabled": false,
"start_time": null,
"day_of_week": "saturday",
"special_date": null,
"seconds_length": null
},
{
"id": "36aabbf5-3329-48ba-a35e-a073706edbde",
"closed": false,
"enabled": false,
"start_time": null,
"day_of_week": "sunday",
"special_date": null,
"seconds_length": null
}
],
"pre_order_settings": []
}
]
}
}