> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: onNewOrder(event: NewOrderEvent) # Method package: wixStoresBackend # Method menu location: wixStoresBackend --> Events --> onNewOrder # Method Link: https://dev.wix.com/docs/velo/apis/wix-stores-backend/events/on-new-order.md # Method Description: **Deprecated.** This event will continue to work until September 4, 2024, but a newer version is available at [`wix-ecom-backend.Events.onOrderApproved()`](https://www.wix.com/velo/reference/wix-ecom-backend/events/onorderapproved). We recommend you migrate to the new [Wix eCommerce APIs](https://www.wix.com/velo/reference/wix-ecom-backend/introduction) as soon as possible. An event that fires when a new order is placed. The `onNewOrder()` event handler runs when a new order is placed in your site's store. The received `NewOrderEvent` object contains information about the new order that was placed. > **Note:** Backend events don't work when previewing your site. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## An event when a new order is placed ```javascript // Place this code in the events.js file // of your site's Backend section. import wixData from 'wix-data'; export function wixStores_onNewOrder(event) { const newOrderId = event.orderId; const newOrderBuyerInfo = event.buyerInfo; // Get the new order's line items from the Stores/Orders collection const orderLineItems = wixData.get("Stores/Orders", newOrderId) .then((results) => { return results.lineItems }) .catch((error) => { // Order not found in the Stores/Orders collection console.error(error); }); } /* Full event object: * * { * "orderId": "2cd413bd-ddea-4101-b122-e8b146fec05f", * "number": "10005", * "dateCreated": "2018-08-05T12:33:18.938Z", * "buyerInfo": { * "id": "6g004532-732d-829f-5kf9-f9rk42afpla04m", * "identityType": "MEMBER", * "email": "janedoe@gmail.com", * "firstName": "Jane", * "lastName": "Doe", * "phone": "5555555555" * }, * "currency": "USD", * "weightUnit": "LB", * "totals": { * "subtotal": 99.99, * "shipping": 4.99, * "tax": 8.87, * "discount": 9.99, * "total": 103.86, * "weight": 1.37, * "quantity": 2 * }, * "paymentStatus": "PAID", * "fulfillmentStatus": "FULFILLED", * "billingInfo": { * "paymentMethod": "VISA", * "externalTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb", * "paymentGatewayTransactionId": "29A06193U6234935D", * "paymentProviderTransactionId": "7c03ca74-eaf5-4541-8678-9b857634fdcb" * "address": { * "fullName": { * "firstName": "Jane", * "lastName": "Doe" * }, * "country": "US", * "subdivision": "US-NY", * "city": "New York", * "zipCode": "11215", * "phone": "0555555555", * "email": "janedoe@gmail.com", * "addressLine1": "525 5th Avenue" * } * }, * // The following field is only present when * // the order is a subscription * "subscriptionInfo": { * "id": "6b320feb-ddde-45be-950b-8ed277033579", * "cycleNumber": 1, * "subscriptionSettings": { * "frequency": "MONTH", * "autoRenewal": false, * "billingCycles": 3 * }, * "subscriptionOptionInfo": { * "id": "17c145c2-5d23-42c3-ac0a-e579e99c67fd", * "title": "Coffee of the month", * "description": "Monthly Coffee Sub" * } * } * } * */ ``` ---