Methods

The following methods are available on the global window.ZapietEats object

getLanguage()

Returns the current language locale.

const locale = window.ZapietEats.getLanguage(); 
// Returns: "en"

setLanguage(newLanguage)

Sets the language for the widget.

window.ZapietEats.setLanguage('fr');

getDeliveryOption()

Returns the currently selected delivery option.

const option = window.ZapietEats.getDeliveryOption(); 
// Returns: "pickup" or "delivery"

setDeliveryOption(deliveryOption)

Sets the delivery option.

  1. deliveryOption (string): "pickup" or "delivery".

window.ZapietEats.setDeliveryOption('delivery');

getSelectedRestaurant()

Returns the currently selected restaurant object.

const restaurant = window.ZapietEats.getSelectedRestaurant();

getSelectedMenu()

Returns the currently selected menu object.

getSelectedDate()

Returns the currently selected date as a ZapietDate object.

getLocationInventoryDate()

Returns the date to be used for inventory checks, based on the selected location's timezone.

getSelectedTime()

Returns the currently selected time as a ZapietTime object.

getSettings()

Returns the account settings.

showTopBar()

Shows the top bar of the widget.

hideTopBar()

Hides the top bar of the widget.

getZapietId()

Generates the Zapiet ID string based on the current selection.

getAttributes()

Returns an object containing the cart attributes based on the current selection.

addZapietId()

Adds the Zapiet ID and attributes to the current cart.

getCartLineItemsWithZapietId(cart)

Returns the cart items with the _ZapietId property added to them.

  • cart (optional): The Shopify cart object. If not provided, it fetches the current cart.

openModal()

Opens the widget modal.

closeModal()

Closes the widget modal.

showMessage(data)

Shows a message in the widget.

  • data (object | string): The message data or string.

    • message (string): The message text.

    • type (string): "info" or "error".

    • primaryAction (object): Optional primary action button.

    • secondaryAction (object): Optional secondary action button.

closeMessage()

Closes the currently displayed message.

Last updated