-
-
Notifications
You must be signed in to change notification settings - Fork 0
Ordering
Burger King has a system that allows you to order it using your browser, with click & collect.
Go to https://www.burgerking.fr/restaurants, then search the BK you want to order to. For example, I took the BK at Porte de Clichy.
Right-click on it then select "Inspect". In the devtools, search for a string that is in the form "K0000" (in my case it's K0129),
in the id
attribute.
You just need to do this, replacing "K0129" by yours:
const restaurant = await client.restaurant.fetch('K0129');
const catalog = await restaurant.catalog();
await client.orders.create({
restaurantId: restaurant.id, // String in the format "K0000"
pickUpType: PickUpType.OnSite, // PickUpType.PickUp | PickUpType.OnSite
items: [/* ... */], // Items to order; see next section
});
Creating items to order consists of using the OrderItem
class.
For example, I want to order a Double Steakhouse menu (id: 598
), with a Double Steakhouse (id: 622
), large fries (id: 54
) and a Fuze Tea Peach 50cl (id: 759
). I'll need to do this code:
...
items: [
new OrderItem()
.fromMenu(catalog.getMenu('598')) // Double Steakhouse
.addSubItem(catalog.getProduct('622')) // Double Steakhouse
.addSubItem(catalog.getProduct('54')) // large fries
.addSubItem(catalog.getProduct('759'), { // Fuze Tea Peach 50cl
noIce: false
})
]
Just like that you have an order ready, just start the program to buy :)
If you have crowns, you can use them to get products for free. To apply a promotion on a product (crowns are just promotions in fact), you need to get its id (in the case of promotions the id consists of 19 characters).
For example, if I want to get the menu in the previous example for free using crowns (it will NOT work if you don't have the minimum of crowns required to get that menu for free), I need to use the applyPromotion
method. This promotion id is 8495979608750604949
.
...
items: [
new OrderItem()
...
.addSubItem(...)
.applyPromotion('8495979608750604949', client)
]
If you want to order one thing, but no a menu, like just a drink or a dessert, you need to use the method addItem
. Note that promotions do work here.
...
items: [
new OrderItem()
...
.addSubItem(...),
new OrderItem()
.addItem(catalog.getProduct('370'))
]