> 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: onCartCreated(event: CartCreatedEvent) # Method package: wixStoresBackend # Method menu location: wixStoresBackend --> Events --> onCartCreated # Method Link: https://dev.wix.com/docs/velo/apis/wix-stores-backend/events/on-cart-created.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.onCartCreated()`](https://www.wix.com/velo/reference/wix-ecom-backend/events/oncartcreated). We recommend you migrate to the new [Wix eCommerce APIs](https://www.wix.com/velo/reference/wix-ecom-backend/introduction) as soon as possible. For more info about the differences between the Stores Cart and eCommerce Cart, refer to the [cart conversion table](https://www.wix.com/velo/reference/wix-ecom-backend/cart/stores-to-ecommerce-cart-conversion-table). An event that fires when a cart is created. The `onCartCreated()` event handler runs the first time a site visitor adds a product to their shopping cart. Removing all items from the cart and adding a new item does not create a new cart and does not trigger this event. > **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 shopping cart is created ```javascript // Place this code in the events.js file // of your site's Backend section. export function wixStores_onCartCreated(event) { let total = event.totals.total; } /* Full event object: * * { * "cartId": "6d158831-1510-44ae-a420-1483a4200852", * "creationTime": "2019-02-27T12:03:22.079Z", * "buyerInfo": { * "id": "4kf9ka09-4e9f-a02d-972f-9a5844d9d9a2", * "email": "john.doe@somedomain.com", * "phone": "5555555555", * "firstName": "John", * "lastName": "Doe" * }, * "weightUnit": "LB", * "currency": { * "currency": "USD", * "symbol": "$" * }, * "totals": { * "subtotal": 130, * "discount": 0, * "total": 130, * "quantity": 1 * } * } * */ ``` ---