GraphQL

In this article

Store Configuration

Get Ingredient List

Get Kitchen Status

QR code GraphQL

Anonymous ordering

Sales entries

GraphQL queries to fetch all related information regarding hospitality.

Queries and mutations

Store Configuration

These are all GraphQL store configurations regarding hospitality.

Syntax

Copy
{
  storeConfig {
    ls_mag_ls_industry_ls_choose_industry
    ls_mag_hospitality_service_mode_status
    ls_mag_hospitality_service_mode_options
    ls_mag_hospitality_order_tracking
    ls_mag_hospitality_takeaway_sales_type
    ls_mag_hospitality_delivery_salas_type
    ls_mag_hospitality_show_in_checkout
    ls_mag_hospitality_max_length
    ls_mag_hospitality_collapse_state
    ls_mag_hospitality_content_block
    ls_mag_hospitality_anonymous_order_enabled
    ls_mag_hospitality_anonymous_order_address_attributes_required
    ls_mag_hospitality_qr_order_enabled
    ls_mag_hospitality_qr_order_content_block
    ls_mag_hospitality_qr_order_content_block_pwa
  }
}

Get Ingredient List

Get the list of ingredients from the product.

Request

Copy
query{
  products(filter: { sku: { eq: "R0001" } }) {
    items {
      id
      name
      sku
      __typename
      ... on CustomizableProductInterface {
        options {
          title
          required
          sort_order
          option_id
          ls_modifier_recipe_id
          ... on CustomizableDropDownOption {
            value {
              option_type_id
              uid
              title
              price
              price_type
            }
          }
        }
      }
    }
  }
}

Response

Copy
{
    "data": {
        "products": {
            "items": [
                {
                    "id": 1965,
                    "name": "Chicken w/brown sauce",
                    "sku": "R0001",
                    "__typename": "SimpleProduct",
                    "options": [
                        {
                            "title": "Exclude Ingredients",
                            "required": false,
                            "sort_order": 99,
                            "option_id": 68,
                            "ls_modifier_recipe_id": "ls_rec"
                        },
                        {
                            "title": "Potatoes and Rice",
                            "required": false,
                            "sort_order": 0,
                            "option_id": 97,
                            "ls_modifier_recipe_id": "ls_mod_POT+RICE",
                            "value": [
                                {
                                    "option_type_id": 1038,
                                    "uid": "Y3VzdG9tLW9wdGlvbi85Ny8xMDM4",
                                    "title": "Baked Potato",
                                    "price": 0,
                                    "price_type": "FIXED",
                                    "swatch": ""
                                },
                                {
                                    "option_type_id": 1039,
                                    "uid": "Y3VzdG9tLW9wdGlvbi85Ny8xMDM5",
                                    "title": "Mashed Potatos",
                                    "price": 0,
                                    "price_type": "FIXED",
                                    "swatch": ""
                                },
                                {
                                    "option_type_id": 1040,
                                    "uid": "Y3VzdG9tLW9wdGlvbi85Ny8xMDQw",
                                    "title": "French Fries",
                                    "price": 0,
                                    "price_type": "FIXED",
                                    "swatch": ""
                                },
                                {
                                    "option_type_id": 1041,
                                    "uid": "Y3VzdG9tLW9wdGlvbi85Ny8xMDQx",
                                    "title": "Basmati Rice",
                                    "price": 0,
                                    "price_type": "FIXED",
                                    "swatch": ""
                                },
                                {
                                    "option_type_id": 1042,
                                    "uid": "Y3VzdG9tLW9wdGlvbi85Ny8xMDQy",
                                    "title": "Wild Rice",
                                    "price": 0,
                                    "price_type": "FIXED",
                                    "swatch": ""
                                },
                                {
                                    "option_type_id": 1043,
                                    "uid": "Y3VzdG9tLW9wdGlvbi85Ny8xMDQz",
                                    "title": "Plain Rice",
                                    "price": 0,
                                    "price_type": "FIXED",
                                    "swatch": ""
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}

Get Kitchen Status

Get the kitchen status for the order.

Request

Copy
query {
  fetch_order_kitchen_information (
    order_id: "00000P0119000000078"
  ) {
    status_code
    status_description
    estimated_time
    pickup_date
    pickup_time
  }
}

Response

Copy
{
  "data": {
    "fetch_order_kitchen_information": {
      "status_code": "Sent",
      "status_description": "Order sent to Kitchen",
      "estimated_time": "30 Minutes",
      "pickup_date": "2022-09-14",
      "pickup_time": "06:45 PM"
    }
  }
}

QR code GraphQL

Here are the GraphQL query and mutations regarding QR Code ordering.

Request

Copy
mutation {
  setQRCodeParamsInSession(
      qr_code_id: "P3N0b3JlX25vPVMwMDE3JnNhbGVzX3R5cGU9VEFLRUFXQVkmdGFibGVfbm89MQ=="
  ) {
    qr_code_params {
      param_name
      param_value
    }
  }
}

Response

Copy
{
  "data": {
    "setQRCodeParamsInSession": {
      "qr_code_params": [
        {
          "param_name": "store_id",
          "param_value": "S0017"
        },
        {
          "param_name": "sales_type",
          "param_value": "TAKEAWAY"
        },
        {
          "param_name": "table_no",
          "param_value": "1"
        }
      ]
    }
  }
}

Anonymous ordering

Anonymous ordering includes simplified checkout process. In order to work with anonymous ordering, you must add store information in Magento.

Request

Copy
mutation {
  setGivenFieldsOnAddress(
    input: {
      cart_id: "WTGOjXhQq4LbNSP86XzAF5fWsBPW8Jel"
      address_fields: [
        { field_name: "firstname", field_value: "Umar" }
        { field_name: "lastname", field_value: "Yousaf" }
        { field_name: "telephone", field_value: "001001" }
      ]
    }
  ) {
    cart {
      email
      billing_address {
        city
        country {
          code
          label
        }
        firstname
        lastname
        postcode
        telephone
        region {
          code
          label
        }
        street
        telephone
      }
      shipping_addresses {
        firstname
        lastname
        street
        city
        region {
          code
          label
        }
        country {
          code
          label
        }
        telephone
        available_shipping_methods {
          amount {
            currency
            value
          }
          available
          carrier_code
          carrier_title
          error_message
          method_code
          method_title
          price_excl_tax {
            value
            currency
          }
          price_incl_tax {
            value
            currency
          }
        }
        selected_shipping_method {
          amount {
            value
            currency
          }
          carrier_code
          carrier_title
          method_code
          method_title
        }
      }
    }
  }
}

Response

Copy
{
  "data": {
    "setGivenFieldsOnAddress": {
      "cart": {
        "email": "umaryo_retail@lsretail.com",
        "billing_address": {
          "city": "Kópavogur",
          "country": {
            "code": "IS",
            "label": "IS"
          },
          "firstname": "Umar",
          "lastname": "Yousaf",
          "postcode": "201",
          "telephone": "001001",
          "region": {
            "code": "IS-01",
            "label": "Höfuðborgarsvæði"
          },
          "street": [
            "LS Retail ehf."
          ]
        },
        "shipping_addresses": [
          {
            "firstname": "Umar",
            "lastname": "Yousaf",
            "street": [
              "LS Retail ehf."
            ],
            "city": "Kópavogur",
            "region": {
              "code": "IS-01",
              "label": "Höfuðborgarsvæði"
            },
            "country": {
              "code": "IS",
              "label": "IS"
            },
            "telephone": "001001",
            "available_shipping_methods": [
              {
                "amount": {
                  "currency": "USD",
                  "value": 0
                },
                "available": true,
                "carrier_code": "flatrate",
                "carrier_title": "Dine In",
                "error_message": "",
                "method_code": "flatrate",
                "method_title": "Fixed",
                "price_excl_tax": {
                  "value": 0,
                  "currency": "USD"
                },
                "price_incl_tax": {
                  "value": 0,
                  "currency": "USD"
                }
              },
              {
                "amount": {
                  "currency": "USD",
                  "value": 0
                },
                "available": true,
                "carrier_code": "clickandcollect",
                "carrier_title": "TakeAway",
                "error_message": "",
                "method_code": "clickandcollect",
                "method_title": "Fixed",
                "price_excl_tax": {
                  "value": 0,
                  "currency": "USD"
                },
                "price_incl_tax": {
                  "value": 0,
                  "currency": "USD"
                }
              }
            ],
            "selected_shipping_method": {
              "amount": {
                "value": 0,
                "currency": "USD"
              },
              "carrier_code": "flatrate",
              "carrier_title": "Dine In",
              "method_code": "flatrate",
              "method_title": "Fixed"
            }
          }
        ]
      }
    }
  }
}

Sales entries

Sales entries to get hospitality order information including modifiers.

Request

Copy
{
  customer {
    lsSalesEntries(
      filter: { id: "00000P0117000000700", type: "Order" }
      pageSize: 1
    ) {
      id
      click_and_collect_order
      document_reg_time
      external_id
      id_type
      line_item_count
      points_rewarded
      points_used
      posted
      ship_to_name
      ship_to_email
      status
      store_id
      store_name
      total_amount
      total_net_amount
      total_discount
      contact_address {
        address1
        address2
        cell_phone_number
        city
        country
        house_no
        post_code
        state_province_region
        type
      }
      ship_to_address {
        address1
        address2
        cell_phone_number
        city
        country
        house_no
        post_code
        state_province_region
        type
      }
      payments {
        amount
        card_no
        currency_code
        currency_factor
        line_number
        tender_type
      }
      items {
        amount
        click_and_collect_line
        discount_amount
        discount_percent
        item_description
        item_id
        item_image_id
        line_number
        line_type
        net_amount
        net_price
        parent_line
        price
        quantity
        store_id
        tax_amount
        uom_id
        variant_description
        variant_id
        custom_options {
            label
            value
        }
        subitems {
            amount
            click_and_collect_line
            discount_amount
            discount_percent
            item_description
            item_id
            item_image_id
            line_number
            line_type
            net_amount
            net_price
            parent_line
            price
            quantity
            store_id
            tax_amount
            uom_id
            variant_description
            variant_id
            subitems {
                amount
                click_and_collect_line
                discount_amount
                discount_percent
                item_description
                item_id
                item_image_id
                line_number
                line_type
                net_amount
                net_price
                parent_line
                price
                quantity
                store_id
                tax_amount
                uom_id
                variant_description
                variant_id
            }
        }
      }
    }
  }
}

Response

Copy
{
    "data": {
        "customer": {
            "lsSalesEntries": [
                {
                    "id": "00000P0117000000706",
                    "click_and_collect_order": "",
                    "document_reg_time": "2023-02-09T15:42:57.447",
                    "external_id": "PR-H-2000000492",
                    "id_type": "HospOrder",
                    "line_item_count": 6,
                    "points_rewarded": 0,
                    "points_used": 0,
                    "posted": "",
                    "ship_to_name": "",
                    "ship_to_email": "",
                    "status": "Pending",
                    "store_id": "S0017",
                    "store_name": "EasyBurger",
                    "total_amount": 15.2,
                    "total_net_amount": 13.818181818182,
                    "total_discount": 0,
                    "contact_address": {
                        "address1": "test",
                        "address2": "",
                        "cell_phone_number": "",
                        "city": "",
                        "country": "",
                        "house_no": "",
                        "post_code": "",
                        "state_province_region": "",
                        "type": "Residential"
                    },
                    "ship_to_address": {
                        "address1": "",
                        "address2": "",
                        "cell_phone_number": "",
                        "city": "",
                        "country": "",
                        "house_no": "",
                        "post_code": "",
                        "state_province_region": "",
                        "type": "Residential"
                    },
                    "payments": [],
                    "items": [
                        {
                            "amount": 7.9,
                            "click_and_collect_line": "",
                            "discount_amount": 0,
                            "discount_percent": 0,
                            "item_description": "Gourmet Burger",
                            "item_id": "R0029",
                            "item_image_id": "R0029",
                            "line_number": "10000",
                            "line_type": "Item",
                            "net_amount": 7.1818181818182,
                            "net_price": 7.18,
                            "parent_line": "0",
                            "price": 7.9,
                            "quantity": 1,
                            "store_id": "S0017",
                            "tax_amount": 0.71818181818182,
                            "uom_id": "",
                            "variant_description": "",
                            "variant_id": "",
                            "custom_options": [
                                {
                                    "label": "Easy Cheeses",
                                    "value": "Cheddar Cheese"
                                },
                                {
                                    "label": "Easy Sauces",
                                    "value": "Bearnaise Sauce"
                                },
                                {
                                    "label": "Exclude Ingredients",
                                    "value": "Burger Patty"
                                }
                            ],
                            "subitems": [
                                {
                                    "amount": 0.1,
                                    "click_and_collect_line": "",
                                    "discount_amount": 0,
                                    "discount_percent": 0,
                                    "item_description": "Cheddar Cheese",
                                    "item_id": "34641",
                                    "item_image_id": "34641",
                                    "line_number": "20000",
                                    "line_type": "Item",
                                    "net_amount": 0.090909090909091,
                                    "net_price": 0.09,
                                    "parent_line": "10000",
                                    "price": 0.1,
                                    "quantity": 1,
                                    "store_id": "S0017",
                                    "tax_amount": 0.0090909090909091,
                                    "uom_id": "",
                                    "variant_description": "",
                                    "variant_id": "",
                                    "subitems": null
                                },
                                {
                                    "amount": 0.1,
                                    "click_and_collect_line": "",
                                    "discount_amount": 0,
                                    "discount_percent": 0,
                                    "item_description": "Bearnaise Sauce",
                                    "item_id": "34510",
                                    "item_image_id": "34510",
                                    "line_number": "30000",
                                    "line_type": "Item",
                                    "net_amount": 0.090909090909091,
                                    "net_price": 0.09,
                                    "parent_line": "10000",
                                    "price": 0.1,
                                    "quantity": 1,
                                    "store_id": "S0017",
                                    "tax_amount": 0.0090909090909091,
                                    "uom_id": "",
                                    "variant_description": "",
                                    "variant_id": "",
                                    "subitems": null
                                },
                                {
                                    "amount": 0,
                                    "click_and_collect_line": "",
                                    "discount_amount": 0,
                                    "discount_percent": 0,
                                    "item_description": "Burger Patty",
                                    "item_id": "R0023",
                                    "item_image_id": "R0023",
                                    "line_number": "40000",
                                    "line_type": "Item",
                                    "net_amount": 0,
                                    "net_price": 0,
                                    "parent_line": "10000",
                                    "price": 0,
                                    "quantity": -1,
                                    "store_id": "S0017",
                                    "tax_amount": 0,
                                    "uom_id": "PORTION",
                                    "variant_description": "",
                                    "variant_id": "",
                                    "subitems": null
                                }
                            ]
                        },
                        {
                            "amount": 0,
                            "click_and_collect_line": "",
                            "discount_amount": 0,
                            "discount_percent": 0,
                            "item_description": "Vegaterian Burger meal",
                            "item_id": "S10031",
                            "item_image_id": "",
                            "line_number": "40250",
                            "line_type": "Deal",
                            "net_amount": 0,
                            "net_price": 0,
                            "parent_line": "0",
                            "price": 6.9,
                            "quantity": 1,
                            "store_id": "S0017",
                            "tax_amount": 0,
                            "uom_id": "",
                            "variant_description": "",
                            "variant_id": "",
                            "custom_options": [
                                {
                                    "label": "Easy Cheeses",
                                    "value": "Cheddar Cheese"
                                },
                                {
                                    "label": "Easy Sauces",
                                    "value": "Bearnaise Sauce"
                                },
                                {
                                    "label": "Exclude Ingredients",
                                    "value": "Vegatable Patty"
                                },
                                {
                                    "label": "Easy Burger Sides",
                                    "value": "Fries Large"
                                },
                                {
                                    "label": "Easy Burger Drinks",
                                    "value": "Cola Large"
                                }
                            ],
                            "subitems": [
                                {
                                    "amount": 4.3,
                                    "click_and_collect_line": "",
                                    "discount_amount": 0,
                                    "discount_percent": 0,
                                    "item_description": "Vegaterian Burger",
                                    "item_id": "R0034",
                                    "item_image_id": "R0034",
                                    "line_number": "50000",
                                    "line_type": "Item",
                                    "net_amount": 3.9090909090909,
                                    "net_price": 3.91,
                                    "parent_line": "40250",
                                    "price": 4.3,
                                    "quantity": 1,
                                    "store_id": "S0017",
                                    "tax_amount": 0.39090909090909,
                                    "uom_id": "PORTION",
                                    "variant_description": "",
                                    "variant_id": "",
                                    "subitems": [
                                        {
                                            "amount": 0.1,
                                            "click_and_collect_line": "",
                                            "discount_amount": 0,
                                            "discount_percent": 0,
                                            "item_description": "Cheddar Cheese",
                                            "item_id": "34641",
                                            "item_image_id": "34641",
                                            "line_number": "60000",
                                            "line_type": "Item",
                                            "net_amount": 0.090909090909091,
                                            "net_price": 0.09,
                                            "parent_line": "50000",
                                            "price": 0.1,
                                            "quantity": 1,
                                            "store_id": "S0017",
                                            "tax_amount": 0.0090909090909091,
                                            "uom_id": "",
                                            "variant_description": "",
                                            "variant_id": ""
                                        },
                                        {
                                            "amount": 0.1,
                                            "click_and_collect_line": "",
                                            "discount_amount": 0,
                                            "discount_percent": 0,
                                            "item_description": "Bearnaise Sauce",
                                            "item_id": "34510",
                                            "item_image_id": "34510",
                                            "line_number": "70000",
                                            "line_type": "Item",
                                            "net_amount": 0.090909090909091,
                                            "net_price": 0.09,
                                            "parent_line": "50000",
                                            "price": 0.1,
                                            "quantity": 1,
                                            "store_id": "S0017",
                                            "tax_amount": 0.0090909090909091,
                                            "uom_id": "",
                                            "variant_description": "",
                                            "variant_id": ""
                                        },
                                        {
                                            "amount": 0,
                                            "click_and_collect_line": "",
                                            "discount_amount": 0,
                                            "discount_percent": 0,
                                            "item_description": "Vegetable Patty",
                                            "item_id": "34020",
                                            "item_image_id": "34020",
                                            "line_number": "80000",
                                            "line_type": "Item",
                                            "net_amount": 0,
                                            "net_price": 0,
                                            "parent_line": "50000",
                                            "price": 0,
                                            "quantity": -1,
                                            "store_id": "S0017",
                                            "tax_amount": 0,
                                            "uom_id": "PCS",
                                            "variant_description": "",
                                            "variant_id": ""
                                        }
                                    ]
                                },
                                {
                                    "amount": 2.06,
                                    "click_and_collect_line": "",
                                    "discount_amount": 0,
                                    "discount_percent": 0,
                                    "item_description": "Fries",
                                    "item_id": "33410",
                                    "item_image_id": "33410",
                                    "line_number": "90000",
                                    "line_type": "Item",
                                    "net_amount": 1.8727272727273,
                                    "net_price": 1.87,
                                    "parent_line": "40250",
                                    "price": 2.06,
                                    "quantity": 1,
                                    "store_id": "S0017",
                                    "tax_amount": 0.18727272727273,
                                    "uom_id": "LAR",
                                    "variant_description": "",
                                    "variant_id": "",
                                    "subitems": null
                                },
                                {
                                    "amount": 0.54,
                                    "click_and_collect_line": "",
                                    "discount_amount": 0,
                                    "discount_percent": 0,
                                    "item_description": "Cola",
                                    "item_id": "30500",
                                    "item_image_id": "30500",
                                    "line_number": "100000",
                                    "line_type": "Item",
                                    "net_amount": 0.49090909090909,
                                    "net_price": 0.49,
                                    "parent_line": "40250",
                                    "price": 0.54,
                                    "quantity": 1,
                                    "store_id": "S0017",
                                    "tax_amount": 0.049090909090909,
                                    "uom_id": "LAR",
                                    "variant_description": "",
                                    "variant_id": "",
                                    "subitems": null
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}