Basic Order Settings
Our front-end has several basic order settings that must be made before a menu is shown to the user.
The below outlines the key examples and sub-choices made for each order type:
Multiple order types
Many clients will offer multiple order types. (eg: delivery or Collection). In this case you need to choose the order type and direct the user down the appropriate flow.
This is configured by the client on a store-by-store level inside Controls.slerp.com so can be changed by the client at any time. As such it's important it is managed dynamically to avoid unnexpected behaviour.
Click and Collect & Delivery
How do I find out if the merchant offers click and collect or delivery
First run a query which includes merchant settings, for example:
query MyQuery {
merchants(where: {slug: {_eq: "MERCHANT_SLUG"}}) {
setting
}
}
This will return a setting JSON with a number of key boolean values including:
same_day_pickup
- if true at least one store offers pickup on the same daypre_order_pickup
- if true at least one store offers pickup for a future daysame_day_delivery
- if true at least one store offers delivery on the same daypre_order_delivery
- if true at least one store offers delivery on the same day
How do I find stores available for click and collect or delivery on a given day?
We cover this with our GetValidStores query which is discussed in out Get Valid Stores and Timeslots section below.
How do I pass this data to Slerp when creating a Slerp Cart
To create the cart run this mutation:
mutation CreateSlerpCart($storeId: ID!, $merchantId: ID!, $fulfillmentType: String!, $deliveryAddress: DeliveryAddressParams, $fulfillmentDate: String, $fulfillmentTime: String, $orderItems: [OrderItemParams], $customerId: ID!) {
createSlerpCart(
storeId: $storeId
merchantId: $merchantId
fulfillmentType: $fulfillmentType
deliveryAddress: $deliveryAddress
fulfillmentDate: $fulfillmentDate
fulfillmentTime: $fulfillmentTime
orderItems: $orderItems
customerId: $customerId
) {
id
}
}
With these variables:
{
"storeId": "1dc13cfa-b411-433c-b58a-0ef5866c391a",
"merchantId": "2ba090b2-d4dc-4fd1-ba5c-9e0b73586673",
"fulfillmentType": "pickup", //delivery if a delivery order (all lower case)
"fulfillmentDate": "2022-07-01", // the date the order is for, can be today or future day, should always be yyyy-mm-dd format
"fulfillmentTime": "asap", // pass asap in lower case if order is for asap, otherwise pass a timeslot from thos provided by the getValidStores query in this format: HH:MM
"deliveryAddress": null, //blank if a pickup order
"orderItems": [ // covered in detail in createSlerpCart page
{
"productVariantId": "a0bcf166-0580-4103-ae7b-ecf682783429",
"quantity": 1,
"appliedModifiers": []
}
],
"customerId": "f95d1aa7-612b-452a-a43a-fe8f74bf43a7" // if no customer logged in leave as null
}
Success Response will return a cart ID like:
{
"data": {
"createSlerpCart": {
"id": "fbb37413-138d-4c85-9e0a-a1ed2d081851"
}
}
}
Order times
Slerp Allows orders for 4 broad time groups:
- ASAP: This means I want the food right now, as soon as possible.
- Scheduled Same Day: This means I am ordering now for a later time today, eg: Order in the morning for lunch or dinner.
- Pre-Orders: This Means I am ordering now for a collection on a future day.
Click and Collect or Delivery orders can be any one of the above times.
This is also configured by the client on a store-by-store level inside controls.slerp.com
so can be changed by the client at any time.
The best way to make sure only valid order times is returned is by using the GetValidStores query below:
Get Valid Stores and timeslots
When completing an order for Delivery or Collection you will need to find out what stores are available on the chosen day and what time-slots they have available.
This can be found via the getValidStores
query:
query getValidAvailableStores($merchantId: String!, $fulfillmentType: String!, $fulfillmentDate: String!, $address: String) {
getValidStores(
merchantId: $merchantId
fulfillmentType: $fulfillmentType
fulfillmentDate: $fulfillmentDate
address: $address
) {
stores {
name
id
fulfillmentTimeslots(
fulfillmentDate: $fulfillmentDate
fulfillmentType: $fulfillmentType
) {
endTime
startTime
value
}
}
errors {
message
store {
id
name
}
}
}
This will return 2 arrays:
1) errors: This contains messages for each closed / unavailable store as to why no slots are available
2) stores: This contains an object for each store containing the store name and ID and an array of each available timeslot for that store on the given date.
Sample variables:
{
"merchantId": "2ba090b2-d4dc-4fd1-ba5c-9e0b73586673", // Your merchant ID
"fulfillmentType": "pickup", // Order type 'pickup' or 'delivery'
"fulfillmentDate": "2022-07-01", // date in yyyy-mm-dd format
"address": "" // address if for delivery
}
Sample Response:
{
"data": {
"getValidStores": [
{
"errors": [],
"stores": [
{
"fulfillmentTimeslots": [
{
"endTime": null,
"startTime": null,
"value": "asap"
},
{
"endTime": "12:00:00.000000",
"startTime": "11:45:00.000000",
"value": "2022-07-01T11:45:00.000000+01:00"
},
{
"endTime": "12:15:00.000000",
"startTime": "12:00:00.000000",
"value": "2022-07-01T12:00:00.000000+01:00"
},
{
"endTime": "12:30:00.000000",
"startTime": "12:15:00.000000",
"value": "2022-07-01T12:15:00.000000+01:00"
},
{
"endTime": "12:45:00.000000",
"startTime": "12:30:00.000000",
"value": "2022-07-01T12:30:00.000000+01:00"
},
{
"endTime": "13:00:00.000000",
"startTime": "12:45:00.000000",
"value": "2022-07-01T12:45:00.000000+01:00"
},
{
"endTime": "13:15:00.000000",
"startTime": "13:00:00.000000",
"value": "2022-07-01T13:00:00.000000+01:00"
},
{
"endTime": "13:30:00.000000",
"startTime": "13:15:00.000000",
"value": "2022-07-01T13:15:00.000000+01:00"
},
{
"endTime": "13:45:00.000000",
"startTime": "13:30:00.000000",
"value": "2022-07-01T13:30:00.000000+01:00"
},
{
"endTime": "14:00:00.000000",
"startTime": "13:45:00.000000",
"value": "2022-07-01T13:45:00.000000+01:00"
},
{
"endTime": "14:15:00.000000",
"startTime": "14:00:00.000000",
"value": "2022-07-01T14:00:00.000000+01:00"
},
{
"endTime": "14:30:00.000000",
"startTime": "14:15:00.000000",
"value": "2022-07-01T14:15:00.000000+01:00"
},
{
"endTime": "14:45:00.000000",
"startTime": "14:30:00.000000",
"value": "2022-07-01T14:30:00.000000+01:00"
},
{
"endTime": "15:00:00.000000",
"startTime": "14:45:00.000000",
"value": "2022-07-01T14:45:00.000000+01:00"
},
{
"endTime": "15:15:00.000000",
"startTime": "15:00:00.000000",
"value": "2022-07-01T15:00:00.000000+01:00"
},
{
"endTime": "15:30:00.000000",
"startTime": "15:15:00.000000",
"value": "2022-07-01T15:15:00.000000+01:00"
},
{
"endTime": "15:45:00.000000",
"startTime": "15:30:00.000000",
"value": "2022-07-01T15:30:00.000000+01:00"
},
{
"endTime": "16:00:00.000000",
"startTime": "15:45:00.000000",
"value": "2022-07-01T15:45:00.000000+01:00"
}
],
"id": "be3cfe4e-0109-4016-b26e-0d99a9e44e48",
"name": "Coventry St"
},
{
"fulfillmentTimeslots": [
{
"endTime": null,
"startTime": null,
"value": "asap"
},
{
"endTime": "13:15:00.000000",
"startTime": "13:00:00.000000",
"value": "2022-07-01T13:00:00.000000+01:00"
},
{
"endTime": "13:30:00.000000",
"startTime": "13:15:00.000000",
"value": "2022-07-01T13:15:00.000000+01:00"
},
{
"endTime": "13:45:00.000000",
"startTime": "13:30:00.000000",
"value": "2022-07-01T13:30:00.000000+01:00"
},
{
"endTime": "14:00:00.000000",
"startTime": "13:45:00.000000",
"value": "2022-07-01T13:45:00.000000+01:00"
},
{
"endTime": "14:15:00.000000",
"startTime": "14:00:00.000000",
"value": "2022-07-01T14:00:00.000000+01:00"
},
{
"endTime": "14:30:00.000000",
"startTime": "14:15:00.000000",
"value": "2022-07-01T14:15:00.000000+01:00"
},
{
"endTime": "14:45:00.000000",
"startTime": "14:30:00.000000",
"value": "2022-07-01T14:30:00.000000+01:00"
},
{
"endTime": "15:00:00.000000",
"startTime": "14:45:00.000000",
"value": "2022-07-01T14:45:00.000000+01:00"
},
{
"endTime": "15:15:00.000000",
"startTime": "15:00:00.000000",
"value": "2022-07-01T15:00:00.000000+01:00"
},
{
"endTime": "15:30:00.000000",
"startTime": "15:15:00.000000",
"value": "2022-07-01T15:15:00.000000+01:00"
},
{
"endTime": "15:45:00.000000",
"startTime": "15:30:00.000000",
"value": "2022-07-01T15:30:00.000000+01:00"
},
{
"endTime": "16:00:00.000000",
"startTime": "15:45:00.000000",
"value": "2022-07-01T15:45:00.000000+01:00"
},
{
"endTime": "16:15:00.000000",
"startTime": "16:00:00.000000",
"value": "2022-07-01T16:00:00.000000+01:00"
},
{
"endTime": "16:30:00.000000",
"startTime": "16:15:00.000000",
"value": "2022-07-01T16:15:00.000000+01:00"
},
{
"endTime": "16:45:00.000000",
"startTime": "16:30:00.000000",
"value": "2022-07-01T16:30:00.000000+01:00"
},
{
"endTime": "17:00:00.000000",
"startTime": "16:45:00.000000",
"value": "2022-07-01T16:45:00.000000+01:00"
},
{
"endTime": "17:15:00.000000",
"startTime": "17:00:00.000000",
"value": "2022-07-01T17:00:00.000000+01:00"
},
{
"endTime": "17:30:00.000000",
"startTime": "17:15:00.000000",
"value": "2022-07-01T17:15:00.000000+01:00"
},
{
"endTime": "17:45:00.000000",
"startTime": "17:30:00.000000",
"value": "2022-07-01T17:30:00.000000+01:00"
},
{
"endTime": "18:00:00.000000",
"startTime": "17:45:00.000000",
"value": "2022-07-01T17:45:00.000000+01:00"
},
{
"endTime": "18:15:00.000000",
"startTime": "18:00:00.000000",
"value": "2022-07-01T18:00:00.000000+01:00"
},
{
"endTime": "18:30:00.000000",
"startTime": "18:15:00.000000",
"value": "2022-07-01T18:15:00.000000+01:00"
},
{
"endTime": "18:45:00.000000",
"startTime": "18:30:00.000000",
"value": "2022-07-01T18:30:00.000000+01:00"
},
{
"endTime": "19:00:00.000000",
"startTime": "18:45:00.000000",
"value": "2022-07-01T18:45:00.000000+01:00"
},
{
"endTime": "19:15:00.000000",
"startTime": "19:00:00.000000",
"value": "2022-07-01T19:00:00.000000+01:00"
},
{
"endTime": "19:30:00.000000",
"startTime": "19:15:00.000000",
"value": "2022-07-01T19:15:00.000000+01:00"
},
{
"endTime": "19:45:00.000000",
"startTime": "19:30:00.000000",
"value": "2022-07-01T19:30:00.000000+01:00"
},
{
"endTime": "20:00:00.000000",
"startTime": "19:45:00.000000",
"value": "2022-07-01T19:45:00.000000+01:00"
},
{
"endTime": "20:15:00.000000",
"startTime": "20:00:00.000000",
"value": "2022-07-01T20:00:00.000000+01:00"
},
{
"endTime": "20:30:00.000000",
"startTime": "20:15:00.000000",
"value": "2022-07-01T20:15:00.000000+01:00"
},
{
"endTime": "20:45:00.000000",
"startTime": "20:30:00.000000",
"value": "2022-07-01T20:30:00.000000+01:00"
},
{
"endTime": "21:00:00.000000",
"startTime": "20:45:00.000000",
"value": "2022-07-01T20:45:00.000000+01:00"
},
{
"endTime": "21:15:00.000000",
"startTime": "21:00:00.000000",
"value": "2022-07-01T21:00:00.000000+01:00"
},
{
"endTime": "21:30:00.000000",
"startTime": "21:15:00.000000",
"value": "2022-07-01T21:15:00.000000+01:00"
},
{
"endTime": "21:45:00.000000",
"startTime": "21:30:00.000000",
"value": "2022-07-01T21:30:00.000000+01:00"
},
{
"endTime": "22:00:00.000000",
"startTime": "21:45:00.000000",
"value": "2022-07-01T21:45:00.000000+01:00"
}
],
"id": "0abbac69-1492-40f6-b520-e044b8d57d50",
"name": "Birmingham 2"
},
{
"fulfillmentTimeslots": [
{
"endTime": null,
"startTime": null,
"value": "asap"
},
{
"endTime": "13:15:00.000000",
"startTime": "13:00:00.000000",
"value": "2022-07-01T13:00:00.000000+01:00"
},
{
"endTime": "13:30:00.000000",
"startTime": "13:15:00.000000",
"value": "2022-07-01T13:15:00.000000+01:00"
},
{
"endTime": "13:45:00.000000",
"startTime": "13:30:00.000000",
"value": "2022-07-01T13:30:00.000000+01:00"
},
{
"endTime": "14:00:00.000000",
"startTime": "13:45:00.000000",
"value": "2022-07-01T13:45:00.000000+01:00"
},
{
"endTime": "14:15:00.000000",
"startTime": "14:00:00.000000",
"value": "2022-07-01T14:00:00.000000+01:00"
},
{
"endTime": "14:30:00.000000",
"startTime": "14:15:00.000000",
"value": "2022-07-01T14:15:00.000000+01:00"
},
{
"endTime": "14:45:00.000000",
"startTime": "14:30:00.000000",
"value": "2022-07-01T14:30:00.000000+01:00"
},
{
"endTime": "15:00:00.000000",
"startTime": "14:45:00.000000",
"value": "2022-07-01T14:45:00.000000+01:00"
},
{
"endTime": "15:15:00.000000",
"startTime": "15:00:00.000000",
"value": "2022-07-01T15:00:00.000000+01:00"
},
{
"endTime": "15:30:00.000000",
"startTime": "15:15:00.000000",
"value": "2022-07-01T15:15:00.000000+01:00"
},
{
"endTime": "15:45:00.000000",
"startTime": "15:30:00.000000",
"value": "2022-07-01T15:30:00.000000+01:00"
},
{
"endTime": "16:00:00.000000",
"startTime": "15:45:00.000000",
"value": "2022-07-01T15:45:00.000000+01:00"
},
{
"endTime": "16:15:00.000000",
"startTime": "16:00:00.000000",
"value": "2022-07-01T16:00:00.000000+01:00"
},
{
"endTime": "16:30:00.000000",
"startTime": "16:15:00.000000",
"value": "2022-07-01T16:15:00.000000+01:00"
},
{
"endTime": "16:45:00.000000",
"startTime": "16:30:00.000000",
"value": "2022-07-01T16:30:00.000000+01:00"
},
{
"endTime": "17:00:00.000000",
"startTime": "16:45:00.000000",
"value": "2022-07-01T16:45:00.000000+01:00"
},
{
"endTime": "17:15:00.000000",
"startTime": "17:00:00.000000",
"value": "2022-07-01T17:00:00.000000+01:00"
},
{
"endTime": "17:30:00.000000",
"startTime": "17:15:00.000000",
"value": "2022-07-01T17:15:00.000000+01:00"
},
{
"endTime": "17:45:00.000000",
"startTime": "17:30:00.000000",
"value": "2022-07-01T17:30:00.000000+01:00"
},
{
"endTime": "18:00:00.000000",
"startTime": "17:45:00.000000",
"value": "2022-07-01T17:45:00.000000+01:00"
},
{
"endTime": "18:15:00.000000",
"startTime": "18:00:00.000000",
"value": "2022-07-01T18:00:00.000000+01:00"
},
{
"endTime": "18:30:00.000000",
"startTime": "18:15:00.000000",
"value": "2022-07-01T18:15:00.000000+01:00"
},
{
"endTime": "18:45:00.000000",
"startTime": "18:30:00.000000",
"value": "2022-07-01T18:30:00.000000+01:00"
},
{
"endTime": "19:00:00.000000",
"startTime": "18:45:00.000000",
"value": "2022-07-01T18:45:00.000000+01:00"
},
{
"endTime": "19:15:00.000000",
"startTime": "19:00:00.000000",
"value": "2022-07-01T19:00:00.000000+01:00"
},
{
"endTime": "19:30:00.000000",
"startTime": "19:15:00.000000",
"value": "2022-07-01T19:15:00.000000+01:00"
},
{
"endTime": "19:45:00.000000",
"startTime": "19:30:00.000000",
"value": "2022-07-01T19:30:00.000000+01:00"
},
{
"endTime": "20:00:00.000000",
"startTime": "19:45:00.000000",
"value": "2022-07-01T19:45:00.000000+01:00"
},
{
"endTime": "20:15:00.000000",
"startTime": "20:00:00.000000",
"value": "2022-07-01T20:00:00.000000+01:00"
},
{
"endTime": "20:30:00.000000",
"startTime": "20:15:00.000000",
"value": "2022-07-01T20:15:00.000000+01:00"
},
{
"endTime": "20:45:00.000000",
"startTime": "20:30:00.000000",
"value": "2022-07-01T20:30:00.000000+01:00"
},
{
"endTime": "21:00:00.000000",
"startTime": "20:45:00.000000",
"value": "2022-07-01T20:45:00.000000+01:00"
},
{
"endTime": "21:15:00.000000",
"startTime": "21:00:00.000000",
"value": "2022-07-01T21:00:00.000000+01:00"
},
{
"endTime": "21:30:00.000000",
"startTime": "21:15:00.000000",
"value": "2022-07-01T21:15:00.000000+01:00"
},
{
"endTime": "21:45:00.000000",
"startTime": "21:30:00.000000",
"value": "2022-07-01T21:30:00.000000+01:00"
},
{
"endTime": "22:00:00.000000",
"startTime": "21:45:00.000000",
"value": "2022-07-01T21:45:00.000000+01:00"
}
],
"id": "7faddc1d-9f1a-4d3f-aec4-d945ffc565cb",
"name": "Manchester"
}
]
}
]
}
}