> 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: onCartCompleted(event: CartCompletedEvent) # Method package: wixStoresBackend # Method menu location: wixStoresBackend --> Events --> onCartCompleted # Method Link: https://dev.wix.com/docs/velo/apis/wix-stores-backend/events/on-cart-completed.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.onCheckoutCompleted()`](https://www.wix.com/velo/reference/wix-ecom-backend/events/oncheckoutcompleted). 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 visitor completes a purchase from a shopping cart. The `onCartCompleted()` event handler runs when a visitor completes a purchase from a shopping cart. > **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 with pickup details when a shopping cart is completed ```javascript // Place this code in the events.js file // of your site's Backend section. export function wixStores_onCartCompleted(event) { let total = event.totals.total; } /* Full event object: * * { * "cartId": "6d158831-1510-44ae-a420-1483a4200852", * "completedTime": "2019-02-27T12:08:16.160Z", * "buyerInfo": { * "id": "091a8443-ab85-480c-918b-777156358dfc", * "firstName": "John", * "lastName": "Doe" * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "identityType": "CONTACT" * }, * "weightUnit": "LB", * "buyerNote": "This is a note from the buyer.", * "billingAddress": { * "firstName": "John", * "lastName": "Doe" * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "address": "235 W 23rd St, New York, NY 10011, USA" * }, * "currency": { * "currency": "USD", * "symbol": "$" * }, * "appliedCoupon": { * "couponId": "e81e9c48-f954-4044-ba64-ccfe5c103c8f", * "name": "Summer Sale", * "code": "SummerSale", * "discountValue": "$10.00", * "couponType": "MoneyOff" * }, * "totals": { * "subtotal": 250, * "discount": 10, * "total": 240, * "quantity": 2 * }, * "shippingInfo": { * "pickupDetails": { * "firstName": "John", * "lastName": "Doe" * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "address": "235 W 23rd St, New York, NY 10011, USA" * }, * } * } * */ ``` ## An event with shipping details when a shopping cart is completed ```javascript // Place this code in the events.js file // of your site's Backend section. export function wixStores_onCartCompleted(event) { let total = event.totals.total; } /* Full event object: * * { * "cartId": "6d158831-1510-44ae-a420-1483a4200852", * "completedTime": "2019-02-27T12:08:16.160Z", * "buyerInfo": { * "id": "091a8443-ab85-480c-918b-777156358dfc", * "firstName": "John", * "lastName": "Doe" * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "identityType": "CONTACT" * }, * "weightUnit": "LB", * "buyerNote": "This is a note from the buyer.", * "billingAddress": { * "firstName": "John", * "lastName": "Doe" * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "address": "235 W 23rd St, New York, NY 10011, USA" * }, * "currency": { * "currency": "USD", * "symbol": "$" * }, * "appliedCoupon": { * "couponId": "e81e9c48-f954-4044-ba64-ccfe5c103c8f", * "name": "Summer Sale", * "code": "SummerSale", * "discountValue": "$10.00", * "couponType": "MoneyOff" * }, * "totals": { * "subtotal": 250, * "discount": 10, * "total": 240, * "quantity": 2 * }, * "shippingInfo": { * "billingAddress": { * "firstName": "John", * "lastName": "Doe" * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "address": "235 W 23rd St, New York, NY 10011, USA" * }, * } * } * */ ``` ---