Introduction

The Operations API allows you to create and manage operations at restaurants. An operation refers to different services a restaurant may offer. For example, a restaurant may offer a takeaway operation and a catering operation, where each one would work with different time frames, availabilities, and fees.

With the Operations API, you can:

  • Create operations.
  • Retrieve and query existing operations.
  • Update existing operations.

Before you begin

It’s important to note the following points before starting to code:

  • The site or project owner must install the Wix Restaurants Orders (New) app.

Terminology

  • Operation: Restaurant service that includes various aspects of its online ordering.
  • Scheduling: Time-related aspects of order placement.
  • Fulfillment methods: Ways in which a restaurant can provide orders to its customers. See Fulfillment Methods.
  • Service fees: A rule defines the fee that is applied when specific conditions (also defined by the rule) are met. You can use a rule to apply a service fee to a restaurant order. See Service Fees.
Did this help?

Setup

@wix/restaurants

To use the Operations API, install the @wix/restaurants package using npm or Yarn:

Copy
npm install @wix/restaurants

or

Copy
yarn add @wix/restaurants

Then import { operations } from @wix/restaurants:

Copy
import { operations } from "@wix/restaurants";
Did this help?

createOperation( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Creates a new operation.

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function createOperation(operation: Operation): Promise<Operation>;
Method Parameters
operationOperationRequired

Operation to create.

Returns
Return Type:Promise<Operation>
JavaScript
import { operations } from "@wix/restaurants"; async function createOperation(operation) { const response = await operations.createOperation(operation); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

deleteOperation( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Deletes an operation.

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function deleteOperation(operationId: string): Promise<void>;
Method Parameters
operationIdstringRequired

ID of the operation to delete.

JavaScript
import { operations } from "@wix/restaurants"; async function deleteOperation(operationId) { const response = await operations.deleteOperation(operationId); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?