> 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

# Resource: Draft Orders

# Type: Draft Order Object

# Link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/draft-orders/draft-order-object.md

## Description: A temporary, editable version of an order. Use draft orders to modify pricing, line items, or discounts on an existing order before committing the changes.

When committed, the draft order's changes are applied to the original order.

## Schema:

```json
 Type: Draft Order Object | type: DraftOrder
 Description: A temporary, editable version of an order. Use draft orders to modify pricing, line items, or discounts on an existing order before committing the changes.

When committed, the draft order's changes are applied to the original order.
       - name: id  | type: string | description: Draft order ID.
           - name: value  | type: string | description: 
       - name: orderId  | type: string | description: ID of the order this draft commits to.
       - name: lineItems  | type: Array<ItemDetails> | description: Line items. Includes details about changes when relevant.
           - name: lineItem  | type: OrderLineItem | description: Line item details after applied changes.
               - name: id  | type: string | description: Line item ID.
               - name: productName  | type: ProductName | description: Item name.  + Stores - `product.name` + Bookings - `service.info.name` + Events - `ticket.name`
               - name: catalogReference  | type: CatalogReference | description: References to the line item's origin catalog. Empty for custom line items.
               - name: quantity  | type: number | description: Line item quantity.
               - name: totalDiscount  | type: Price | description: Total discount for this line item's entire quantity.
               - name: descriptionLines  | type: Array<DescriptionLine> | description: Line item description lines. Used for display purposes for the cart, checkout and order.
               - name: image  | type: Image | description: Line item image.
               - name: physicalProperties  | type: PhysicalProperties | description: Physical properties of the item. When relevant, contains information such as SKU and item weight.
               - name: itemType  | type: ItemType | description: Item type. Either a preset type or custom.
               - name: fulfillerId  | type: string | description: Fulfiller ID. Field is empty when the line item is self-fulfilled. To get fulfillment information, pass the order ID to [List Fulfillments For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-fulfillments/list-fulfillments-for-single-order.md).
               - name: refundQuantity  | type: number | description: Number of items that were refunded.
               - name: restockQuantity  | type: number | description: Number of items restocked.  For a per-location breakdown, see `restockLocations`.
               - name: price  | type: Price | description: Line item price after line item discounts for display purposes.
               - name: priceBeforeDiscounts  | type: Price | description: Line item price before line item discounts for display purposes. Defaults to `price` when not provided.
               - name: fullPrice  | type: Price | description: Catalog price of a single item, with modifiers, before any discounts, including the catalog-defined discount.  For the price after the catalog-defined discount, see `priceBeforeDiscounts`.  For a catalog line item, returned only when the catalog returns a full price for the item. For a custom line item, the `fullPrice` the caller passed, or its `price` when none was passed.
               - name: totalPriceBeforeTax  | type: Price | description: Total price after discounts, and before tax.
               - name: totalPriceAfterTax  | type: Price | description: Total price after all discounts and tax.
               - name: paymentOption  | type: string | description: Type of selected payment option for current item.  Default: `FULL_PAYMENT_ONLINE`
               - name: taxDetails  | type: ItemTaxFullDetails | description: Deprecated. Use `taxInfo` instead. This field will be removed on September 30, 2024. Tax details for this line item.
               - name: taxInfo  | type: LineItemTaxInfo | description: Represents all the relevant tax details for a specific line item.
               - name: digitalFile  | type: DigitalFile | description: Digital file identifier, relevant only for items with type DIGITAL.
               - name: subscriptionInfo  | type: SubscriptionInfo | description: Subscription info.
               - name: priceDescription  | type: PriceDescription | description: Additional description for the price. For example, when price is 0 but additional details about the actual price are needed - "Starts at $67".
               - name: depositAmount  | type: Price | description: Item's price amount to be charged during checkout. Relevant for items with a `paymentOption` value of `"DEPOSIT_ONLINE"`.
               - name: locations  | type: Array<LocationAndQuantity> | description: Line item locations.  The location's total quantity must not exceed the line item quantity.
               - name: lineItemPrice  | type: Price | description: Total price **after** catalog discounts and line item discounts.
               - name: taxableAddress  | type: TaxableAddress | description: Address used for tax calculation.
               - name: priceUndetermined  | type: boolean | description: Whether the price is not yet defined, and will be updated after the order is created.  Default: `false`
               - name: fixedQuantity  | type: boolean | description: Whether the line item quantity is fixed and cannot be changed.  Default: `false`
               - name: decimalQuantity  | type: DecimalQuantity | description: Decimal-quantity metadata. Set when the line represents a non-integer purchase (e.g. 2.75 m² of fake grass).  When set, the line item must have `fixedQuantity` = true and be set with `quantity` = 1. The decimal value lives in `decimalQuantity.value`.
               - name: extendedFields  | type: ExtendedFields | description: Custom extended fields for the line item object.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.
               - name: modifierGroups  | type: Array<ModifierGroup> | description: Modifier groups that were added to the item.
           - ONE-OF:
               - name: added  | type: boolean | description: Whether the line item was added as part of the draft.
               - name: changedDetails  | type: ItemChangedDetails | description: Line item fields before the change.
                   - name: quantityBeforeChange  | type: number | description: Line item quantity before change.
                   - name: priceBeforeChange  | type: Price | description: Line item price before change.
                   - name: priceDescriptionBeforeChange  | type: PriceDescription | description: Line item price description before change.
                   - name: modifierGroupsBeforeChange  | type: Array<ModifierGroup> | description: Line item modifier groups before change.
               - name: removed  | type: boolean | description: Whether the line item was removed as part of the draft.
       - name: shippingInfo  | type: ShippingDetails | description: Shipping info. Includes details about changes when relevant.
           - name: shippingInfo  | type: ShippingInformation | description: Selected shipping details.
               - name: carrierId  | type: string | description: App Def Id of external provider which was a source of shipping info
               - name: code  | type: string | description: Unique code (or ID) of selected shipping option. For example, `"usps_std_overnight"`.
               - name: title  | type: string | description: Shipping option title. For example, `"USPS Standard Overnight Delivery"`, `"Standard"` or `"First-Class Package International"`.
               - name: logistics  | type: DeliveryLogistics | description: Shipping logistics.
               - name: cost  | type: ShippingPrice | description: Shipping costs.
               - name: region  | type: ShippingRegion | description: Shipping region.
           - ONE-OF:
               - name: added  | type: boolean | description: Whether shipping info was added as part of the draft.
               - name: changedDetails  | type: ShippingChangedDetails | description: Shipping info before the change.
                   - name: shippingInfoBeforeChange  | type: ShippingInformation | description: Shipping info before the change.
               - name: removed  | type: boolean | description: Whether shipping info was removed as part of the draft.
       - name: buyerInfo  | type: BuyerInfo | description: Buyer information.
           - name: contactId  | type: string | description: Contact ID. Automatically created if one doesn't exist. For more information, see [Contacts API](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts/contact-v4/introduction.md).
           - name: email  | type: string | description: Buyer's email address.
           - ONE-OF:
               - name: visitorId  | type: string | description: Visitor ID. Returned when the buyer isn't a logged-in site member.
               - name: memberId  | type: string | description: Member ID. Returned when the buyer is a logged-in site member.
       - name: billingInfo  | type: AddressWithContact | description: Billing address and contact details.
           - name: address  | type: Address | description: Address.
               - name: country  | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format.
               - name: subdivision  | type: string | description: Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format.
               - name: city  | type: string | description: City name.
               - name: postalCode  | type: string | description: Postal or zip code.
               - name: streetAddress  | type: StreetAddress | description: Street address.
               - name: addressLine  | type: string | description: Main address line (usually street name and number).
               - name: addressLine2  | type: string | description: Free text providing more detailed address info. Usually contains apt, suite, floor.
               - name: geocode  | type: AddressLocation | description: Geocode object containing latitude and longitude coordinates.
               - name: countryFullname  | type: string | description: Country's full name.
               - name: subdivisionFullname  | type: string | description: Subdivision full-name.
           - name: contactDetails  | type: FullAddressContactDetails | description: Contact details.
               - name: firstName  | type: string | description: First name.
               - name: lastName  | type: string | description: Last name.
               - name: phone  | type: string | description: Phone number.
               - name: company  | type: string | description: Company name.
               - name: vatId  | type: VatId | description: Tax information (for Brazil only). If ID is provided, `vatId.type` must also be set, `UNSPECIFIED` is not allowed.
       - name: additionalFees  | type: Array<AdditionalFeeDetails> | description: Additional fees.  Includes details about the source, and whether the additional fee is applied to the order.
           - name: additionalFee  | type: AdditionalFee | description: Additional fee.
               - name: code  | type: string | description: Additional fee's unique code for future processing.
               - name: name  | type: string | description: Name of additional fee.
               - name: price  | type: Price | description: Additional fee's price.
               - name: taxDetails  | type: ItemTaxFullDetails | description: Tax details.
               - name: taxInfo  | type: LineItemTaxInfo | description: Represents all the relevant tax details for additional fee.
               - name: providerAppId  | type: string | description: SPI implementer's `appId`.
               - name: priceBeforeTax  | type: Price | description: Additional fee's price before tax.
               - name: priceAfterTax  | type: Price | description: Additional fee's price after tax.
               - name: id  | type: string | description: Additional fee's id.
               - name: lineItemIds  | type: Array<string> | description: Optional - Line items associated with this additional fee. If no `lineItemIds` are provided, the fee will be associated with the whole cart/checkout/order.
               - name: source  | type: string | description: Specifies the entity that added the additional fee.
               - name: taxableAddress  | type: TaxableAddress | description: Address type tax was calculated against for this fee.
           - name: taxDetails  | type: TaxDetails | description: Tax details related to the additional fee.
               - name: taxable  | type: boolean | description: Whether the additional fee is taxable.
               - name: taxGroupId  | type: string | description: Optional tax group ID to use when calculating tax for this additional fee.
           - name: source  | type: string | description: Source of the additional fee.  Supported values: + `ORIGINAL_ORDER`: This additional fee is part of the original order. + `AUTOMATIC`: User added a catalog item which is configured to have an additional fee. + `CUSTOM`: This additional fee was created by the Create Custom Additional Fees method.
               enum: ORIGINAL_ORDER, AUTOMATIC, CUSTOM
           - name: applied  | type: boolean | description: Whether this additional fee is applied to the order.
       - name: discounts  | type: Array<DiscountDetails> | description: Discounts.  Includes details about the source, and whether the discount is applied to the order.
           - name: discount  | type: AppliedDiscount | description: Discount details.
               - name: discountType  | type: string | description: Discount type.
               - name: lineItemIds  | type: Array<string> | description: __Deprecated.__ Use `lineItemDiscounts` instead.  IDs of line items the discount applies to.
               - name: id  | type: string | description: Discount ID.
               - name: lineItemDiscounts  | type: Array<LineItemDiscount> | description: Line items the discount applies to, including the discount amount for each.
               - ONE-OF:
                   - name: coupon  | type: Coupon | description: Coupon applied by the customer.
                   - name: merchantDiscount  | type: MerchantDiscount | description: Discount applied manually by the merchant.
                   - name: discountRule  | type: DiscountRule | description: Automatic discount applied by the system based on configured discount rules.
           - name: source  | type: string | description: Source of the discount.  Supported values: + `ORIGINAL_ORDER`: This discount is part of the original order. + `CUSTOM`: This discount was created by the Create Custom Discounts method.
           - name: applied  | type: boolean | description: Whether this discount is applied to the order.
       - name: createdDate  | type: string | description: Date and time the draft order was created.
           - name: seconds  | type: string | description: 
           - name: nanos  | type: number | description: 
       - name: updatedDate  | type: string | description: Date and time the draft order was updated.
       - name: createdBy  | type: CreatedBy | description: Identity of the draft order's initiator.
           - ONE-OF:
               - name: userId  | type: string | description: User ID. When the draft order was created by a Wix user.
               - name: appId  | type: string | description: App ID. When the draft order was created by an app.
       - name: status  | type: string | description: Draft order status.
           enum: DRAFT, COMMITTED
       - name: weightUnit  | type: string | description: Weight measurement unit. Defaults to the site's weight unit.
           enum: UNSPECIFIED_WEIGHT_UNIT, KG, LB
       - name: currency  | type: string | description: Currency used for pricing.
       - name: priceSummary  | type: PriceSummary | description: Price summary.
           - name: subtotal  | type: Price | description: Subtotal of all line items, before discounts and before tax.
               - name: amount  | type: string | description: Amount.
               - name: formattedAmount  | type: string | description: Amount formatted with currency symbol.
           - name: shipping  | type: Price | description: Total shipping price, before discounts and before tax.
           - name: tax  | type: Price | description: Total tax applied to the order.
           - name: discount  | type: Price | description: Total discount amount applied to the order.
           - name: total  | type: Price | description: Order's total price after discounts and tax.
           - name: totalAdditionalFees  | type: Price | description: Total additional fees before tax.
       - name: taxSummary  | type: TaxSummary | description: Deprecated. Use `taxInfo` instead. This field will be removed on September 30, 2024. Tax summary.
           - name: totalTax  | type: Price | description: Total tax.
       - name: balanceSummary  | type: BalanceSummary | description: Balance summary.
           - name: balance  | type: Balance | description: Amount left to pay for the order to be considered paid.
               - name: amount  | type: string | description: Balance amount.  A negative `amount` represents the amount to be refunded. This can happen due to overcharging or the order being modified after a payment has been made.
               - name: formattedAmount  | type: string | description: Amount formatted with currency symbol.
           - name: paid  | type: Price | description: Sum of all approved and successful payments.  The value includes payments that have subsequently been fully or partially refunded.
           - name: refunded  | type: Price | description: Sum of all successfully refunded payments.
           - name: authorized  | type: Price | description: Sum of all authorized payments.
           - name: platformFees  | type: Price | description: Total platform fees charged across all payments. This reflects amounts collected, which may differ from the expected fees in `draftOrder.platformFeeSummary`.
           - name: totalMinusPlatformFees  | type: Price | description: Order total after deducting platform fees. Represents the net amount payable to the merchant.
           - name: cashRoundingAdjustment  | type: CashRounding | description: The total adjustment applied to the cash payment due to rounding.  Positive values indicate the total was rounded up; negative values indicate it was rounded down.
               - name: amount  | type: string | description: Amount, can be negative or positive.
               - name: formattedAmount  | type: string | description: Amount formatted with currency symbol.
       - name: commitSettings  | type: DraftOrderCommitSettings | description: Side effects to perform on commit.
           - name: sendNotificationsToBuyer  | type: boolean | description: Whether to send notifications to the buyer.  Default: `true`
               - name: value  | type: boolean | description: 
           - name: sendNotificationsToBusiness  | type: boolean | description: Whether to send notifications to the business.  Default: `true`
           - name: addActivitiesToOrder  | type: boolean | description: Whether to add activities to the order.  Default: `true`
           - name: sendNotificationsToCustomFulfillers  | type: boolean | description: Whether to send email notifications to custom fulfillers when there is a change in the shippable items they fulfill.  Default: `true`
           - name: updateInventory  | type: Array<InventoryUpdate> | description: Line item IDs for which to perform an inventory change. When not provided, inventory will not change.
               - name: lineItemId  | type: string | description: Line item ID.
       - name: memberId  | type: string | description: Member ID (if order created by a member).
       - name: purchaseFlowId  | type: string | description: Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order.
       - name: recipientInfo  | type: RecipientInfoDetails | description: Order recipient address and contact details.  This field may differ from the address in `shippingInfo.logistics` when: + The chosen shipping option is pickup point or store pickup. + No shipping option is selected.
           - name: recipientInfo  | type: AddressWithContact | description: Order recipient address and contact details.
           - ONE-OF:
               - name: added  | type: boolean | description: Indicates that recipient information was added during draft.
               - name: changedDetails  | type: RecipientInfoChangedDetails | description: Indicates that recipient information was changed. Contains recipient information before draft.
                   - name: recipientInfoBeforeChange  | type: AddressWithContact | description: Order recipient address and contact details before draft.
               - name: removed  | type: boolean | description: Indicates that recipient information was removed during draft.
       - name: taxInfo  | type: OrderTaxInfo | description: Tax information.
           - name: totalTax  | type: Price | description: Calculated tax, added from line items.
           - name: taxBreakdown  | type: Array<OrderTaxBreakdown> | description: The summary of the tax breakdown for all the line items. It will hold for each tax name, the aggregated tax amount paid for it and the tax rate.
               - name: taxName  | type: string | description: The name of the tax against which this tax amount was calculated.
               - name: taxType  | type: string | description: The type of tax that was calculated. Depends on the company's nexus settings as well as the jurisdiction's tax laws.
               - name: jurisdiction  | type: string | description: The name of the jurisdiction in which this tax detail applies.
               - name: jurisdictionType  | type: string | description: The type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special).
               - name: rate  | type: string | description: The rate at which this tax detail was calculated.
               - name: aggregatedTaxAmount  | type: Price | description: The sum of all the tax from line items that calculated by the tax identifiers.
               - name: aggregatedExemptAmount  | type: Price | description: Total amount exempt from this tax, summed across all line items.
           - name: taxExempt  | type: boolean | description: Whether the order is exempt from tax calculations.  Default: `false`
           - name: totalExempt  | type: Price | description: Total amount exempt from tax calculations.
       - name: extendedFields  | type: ExtendedFields | description: Custom field data for the draft order object.  [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md) must be configured in the [app dashboard](https://dev.wix.com/dc3/my-apps/) before they can be accessed with API calls.
           - name: namespaces  | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
       - name: buyerDetails  | type: BuyerDetails | description: Buyer information.  Includes details about changes when relevant.
           - name: buyerInfo  | type: BuyerInfo | description: Buyer information.
           - ONE-OF:
               - name: added  | type: boolean | description: Indicates that buyer information was added during draft.
               - name: changedDetails  | type: BuyerChangedDetails | description: Indicates that buyer information was changed. Contains buyer information before draft.
                   - name: buyerInfoBeforeChange  | type: BuyerInfo | description: Buyer information before draft.
               - name: removed  | type: boolean | description: Indicates that buyer information was removed during draft.
       - name: billingDetails  | type: BillingDetails | description: Billing address and contact details. Includes details about changes when relevant.
           - name: billingInfo  | type: AddressWithContact | description: Billing address and contact details.
           - ONE-OF:
               - name: added  | type: boolean | description: Indicates that billing information was added during draft.
               - name: changedDetails  | type: BillingChangedDetails | description: Indicates that billing information was changed. Contains billing information before draft.
                   - name: billingInfoBeforeChange  | type: AddressWithContact | description: Billing address and contact details before draft.
               - name: removed  | type: boolean | description: Indicates that billing information was removed during draft.
       - name: businessLocationDetails  | type: BusinessLocationDetails | description: Order business location.  Includes details about changes when relevant.
           - name: businessLocation  | type: Location | description: Business location.
               - name: id  | type: string | description: Location ID. Learn more about the [Wix Locations API](https://dev.wix.com/docs/rest/business-management/locations/introduction.md).
               - name: name  | type: string | description: Location name.
           - ONE-OF:
               - name: added  | type: boolean | description: Indicates that business location was added during draft.
               - name: changedDetails  | type: BusinessLocationChangedDetails | description: Indicates that business location was changed. Contains business location before draft.
                   - name: businessLocationBeforeChange  | type: Location | description: Business location before draft.
               - name: removed  | type: boolean | description: Indicates that business location was removed during draft.
       - name: platformFeeSummary  | type: PlatformFeeSummary | description: Summary of platform fees for this draft order, including totals by charge type and a breakdown of individual fees.
           - name: total  | type: Price | description: Total sum of all platform fees.
           - name: totalPassOn  | type: Price | description: Total amount of platform fees with `PASS_ON` charge type.
           - name: totalAbsorbed  | type: Price | description: Total amount of platform fees with `ABSORBED` charge type.
           - name: fees  | type: Array<PlatformFee> | description: Specific information about each platform fee.
               - name: name  | type: TranslatableString | description: Platform fee name.
               - name: amount  | type: Price | description: Platform fee amount.
               - name: lineItemId  | type: string | description: ID of the line item the platform fee applies to.
               - name: chargeType  | type: string | description: Platform fee charge type.
               - name: percentageRate  | type: string | description: Percentage rate charged as platform fee. The fee rate percentage expressed as a decimal fraction between 0 and 1. For example, `0.05` for 5%.

```