> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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: onCheckoutUpdated(event: CheckoutUpdated)

# Method package: wixEcomBackend

# Method menu location: wixEcomBackend --> onCheckoutUpdated

# Method Link: https://dev.wix.com/docs/velo/events-service-plugins/e-commerce/events/on-checkout-updated.md

# Method Description:

An event that triggers when a checkout is updated. A checkout is updated when, for example, [items are added](https://www.wix.com/velo/reference/wix-ecom-backend/checkout/addtocheckout?branch=autodocs-wix-ecom-backend) or a [coupon is removed](https://www.wix.com/velo/reference/wix-ecom-backend/checkout/removecoupon).


The `onCheckoutUpdated()` event handler runs when a new checkout is updated. The received `CheckoutUpdated` object contains information about the checkout that was updated and event metadata.

> **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 fired when a checkout is updated 

```javascript
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.

export function wixEcom_onCheckoutUpdated(event) {
  const checkoutSubtotal = event.entity.priceSummary.subtotal.amount;
  const checkoutId = event.entity._id;
  const eventId = event.metadata.id;
  console.log('Checkout updated', event)
}

/*  Full event object:
 *
 * {
 *   "metadata": {
 *     "id": "e508b5f9-a7d2-4b37-94ce-2b7767cfa49c",
 *     "entityId": "81b73bc6-d403-4afe-8464-226f9505b1c2",
 *     "eventTime": "2022-10-27T11:42:17.211724Z",
 *     "triggeredByAnonymizeRequest": false
 *   },
 *   "entity": {
 *     "_id": "81b73bc6-d403-4afe-8464-226f9505b1c2",
 *     "lineItems": [
 *       {
 *         "_id": "00000000-0000-0000-0000-000000000001",
 *         "quantity": 3,
 *         "catalogReference": {
 *           "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a",
 *           "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
 *         },
 *         "productName": {
 *           "original": "Shirt",
 *           "translated": "Shirt"
 *         },
 *         "url": "https://example.wixsite.com",
 *         "price": {
 *           "amount": "10",
 *           "convertedAmount": "10",
 *           "formattedAmount": "$10.00",
 *           "formattedConvertedAmount": "$10.00"
 *         },
 *         "lineItemPrice": {
 *           "amount": "30",
 *           "convertedAmount": "30",
 *           "formattedAmount": "$30.00",
 *           "formattedConvertedAmount": "$30.00"
 *         },
 *         "fullPrice": {
 *           "amount": "10",
 *           "convertedAmount": "10",
 *           "formattedAmount": "$10.00",
 *           "formattedConvertedAmount": "$10.00"
 *         },
 *         "priceBeforeDiscounts": {
 *           "amount": "10",
 *           "convertedAmount": "10",
 *           "formattedAmount": "$10.00",
 *           "formattedConvertedAmount": "$10.00"
 *         },
 *         "totalPriceAfterTax": {
 *           "amount": "20",
 *           "convertedAmount": "20",
 *           "formattedAmount": "$20.00",
 *           "formattedConvertedAmount": "$20.00"
 *         },
 *         "totalPriceBeforeTax": {
 *           "amount": "20",
 *           "convertedAmount": "20",
 *           "formattedAmount": "$20.00",
 *           "formattedConvertedAmount": "$20.00"
 *         },
 *         "taxDetails": {
 *           "taxableAmount": {
 *             "amount": "20",
 *             "convertedAmount": "20",
 *             "formattedAmount": "$20.00",
 *             "formattedConvertedAmount": "$20.00"
 *           },
 *           "taxRate": "0",
 *           "totalTax": {
 *             "amount": "0",
 *             "convertedAmount": "0",
 *             "formattedAmount": "$0.00",
 *             "formattedConvertedAmount": "$0.00"
 *           },
 *           "rateBreakdown": []
 *         },
 *         "discount": {
 *           "amount": "10",
 *           "convertedAmount": "10",
 *           "formattedAmount": "$10.00",
 *           "formattedConvertedAmount": "$10.00"
 *         },
 *         "descriptionLines": [],
 *         "media": "wix:image://v1/3c76e2_c5331f937348492a97df87b0a3b34ea4~mv2.jpg#originWidth=1000&originHeight=1000",
 *         "availability": {
 *           "status": "AVAILABLE"
 *         },
 *         "physicalProperties": {
 *           "sku": "364115376135191",
 *           "shippable": true
 *         },
 *         "couponScopes": [
 *           {
 *             "namespace": "stores",
 *             "group": {
 *               "name": "collection",
 *               "entityId": "00000000-000000-000000-000000000001"
 *             }
 *           },
 *           {
 *             "namespace": "stores",
 *             "group": {
 *               "name": "product",
 *               "entityId": "c8539b66-7a44-fe18-affc-afec4be8562a"
 *             }
 *           }
 *         ],
 *         "itemType": {
 *           "preset": "PHYSICAL"
 *         },
 *         "paymentOption": "FULL_PAYMENT_ONLINE",
 *         "rootCatalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a"
 *       }
 *     ],
 *     "shippingInfo": {
 *       "carrierServiceOptions": []
 *     },
 *     "buyerInfo": {
 *       "contactId": "f7dc17a6-825a-466e-a78e-c4abea0217db",
 *       "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
 *     },
 *     "conversionCurrency": "USD",
 *     "priceSummary": {
 *       "subtotal": {
 *         "amount": "30",
 *         "convertedAmount": "30",
 *         "formattedAmount": "$30.00",
 *         "formattedConvertedAmount": "$30.00"
 *       },
 *       "shipping": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "tax": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "discount": {
 *         "amount": "10",
 *         "convertedAmount": "10",
 *         "formattedAmount": "$10.00",
 *         "formattedConvertedAmount": "$10.00"
 *       },
 *       "total": {
 *         "amount": "20",
 *         "convertedAmount": "20",
 *         "formattedAmount": "$20.00",
 *         "formattedConvertedAmount": "$20.00"
 *       },
 *       "additionalFees": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       }
 *     },
 *     "calculationErrors": {
 *       "orderValidationErrors": []
 *     },
 *     "appliedDiscounts": [
 *       {
 *         "discountType": "GLOBAL",
 *         "lineItemIds": [],
 *         "coupon": {
 *           "_id": "fbb94b06-7447-4161-9c48-59bfcdc39e77",
 *           "code": "SUMMERSALE10",
 *           "amount": {
 *             "amount": "10",
 *             "convertedAmount": "10",
 *             "formattedAmount": "$10.00",
 *             "formattedConvertedAmount": "$10.00"
 *           },
 *           "name": "SUMMERSALE10",
 *           "couponType": "MoneyOff"
 *         }
 *       }
 *     ],
 *     "customFields": [],
 *     "weightUnit": "KG",
 *     "currency": "USD",
 *     "channelType": "WEB",
 *     "siteLanguage": "en",
 *     "buyerLanguage": "en",
 *     "completed": false,
 *     "taxIncludedInPrice": false,
 *     "createdBy": {
 *       "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
 *     },
 *     "_createdDate": "2022-10-27T11:42:17.059Z",
 *     "_updatedDate": "2022-10-27T11:42:17.201Z",
 *     "payNow": {
 *       "subtotal": {
 *         "amount": "30",
 *         "convertedAmount": "30",
 *         "formattedAmount": "$30.00",
 *         "formattedConvertedAmount": "$30.00"
 *       },
 *       "shipping": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "tax": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "discount": {
 *         "amount": "10",
 *         "convertedAmount": "10",
 *         "formattedAmount": "$10.00",
 *         "formattedConvertedAmount": "$10.00"
 *       },
 *       "total": {
 *         "amount": "20",
 *         "convertedAmount": "20",
 *         "formattedAmount": "$20.00",
 *         "formattedConvertedAmount": "$20.00"
 *       },
 *       "additionalFees": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       }
 *     },
 *     "payLater": {
 *       "subtotal": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "shipping": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "tax": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "discount": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "total": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       },
 *       "additionalFees": {
 *         "amount": "0",
 *         "convertedAmount": "0",
 *         "formattedAmount": "$0.00",
 *         "formattedConvertedAmount": "$0.00"
 *       }
 *     },
 *     "membershipOptions": {
 *       "eligibleMemberships": [],
 *       "invalidMemberships": [],
 *       "selectedMemberships": {
 *         "memberships": []
 *       }
 *     },
 *     "additionalFees": []
 *   }
 * }
 *
 */
```

---