removeLineItems( )


Removes line items from the specified checkout.

The removeLineItems() function returns a Promise that resolves to the updated checkout when the line items are removed from the specified checkout.

Permissions
Manage eCommerce - all permissions
Manage Stores - all permissions
Manage Orders
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function removeLineItems(
  _id: string,
  lineItemIds: Array<string>,
): Promise<RemoveLineItemsResponse>;
Method Parameters
_idstringRequired

ID of the checkout to remove line items from.


lineItemIdsArray<string>Required

IDs of the line items to be removed. To find the IDs of the checkout line items you'd like to remove, pass the checkout._id to getCheckout() and look for the IDs under lineItems and/or customLineItems.

Returns
Return Type:Promise<RemoveLineItemsResponse>
JavaScript
/************************************** * Backend code - my-backend-file.jsw * **************************************/ import { checkout } from "wix-ecom-backend"; export async function myRemoveLineItemsFunction(checkoutId, lineItemIds) { try { const updatedCheckout = await checkout.removeLineItems( checkoutId, lineItemIds, ); console.log("Success! Line items removed from checkout:", updatedCheckout); return updatedCheckout; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * ************/ import { myRemoveLineItemsFunction } from "backend/my-backend-file"; // Sample checkoutId: const checkoutId = "23a7b29a-3c14-4ef1-9353-f4b714b13217"; // Sample line item IDs const lineItemIds = [ "00000000-0000-0000-0000-000000000002", "00000000-0000-0000-0000-000000000003", ]; myRemoveLineItemsFunction(checkoutId, lineItemIds) .then((updatedCheckout) => { const checkoutId = updatedCheckout._id; const numOfLineItems = updatedCheckout.lineItems.length; console.log("Success! Line items removed from checkout:", updatedCheckout); return updatedCheckout; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * * { * "_id": "23a7b29a-3c14-4ef1-9353-f4b714b13217", * "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" * } * ], * "billingInfo": { * "address": { * "addressLine1": "235 West 23rd Street", * "addressLine2": "3rd floor", * "city": "New York", * "subdivision": "US-NY", * "country": "US", * "postalCode": "10011" * }, * "contactDetails": { * "firstName": "Jane", * "lastName": "Doe", * "phone": "+1234567890" * } * }, * "shippingInfo": { * "shippingDestination": { * "address": { * "addressLine1": "235 West 23rd Street", * "addressLine2": "3rd floor", * "city": "New York", * "subdivision": "US-NY", * "country": "US", * "postalCode": "10011" * }, * "contactDetails": { * "firstName": "Jane", * "lastName": "Doe", * "phone": "+1234567890" * } * }, * "selectedCarrierServiceOption": { * "code": "ed5bbce2-9533-dff4-7db0-13702fd139c5", * "title": "Standard US Shipping", * "logistics": { * "deliveryTime": "" * }, * "cost": { * "totalPriceAfterTax": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "totalPriceBeforeTax": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "taxDetails": { * "taxRate": "0", * "totalTax": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "rateBreakdown": [] * }, * "price": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * } * }, * "requestedShippingOption": true, * "otherCharges": [], * "carrierId": "c8a08776-c095-4dec-8553-8f9698d86adc" * }, * "region": { * "_id": "009fbe5d-89d3-7825-cbbf-1aab4d908b73", * "name": "USA shipping" * }, * "carrierServiceOptions": [ * { * "carrierId": "c8a08776-c095-4dec-8553-8f9698d86adc", * "shippingOptions": [ * { * "code": "ed5bbce2-9533-dff4-7db0-13702fd139c5", * "title": "Standard US Shipping", * "logistics": { * "deliveryTime": "" * }, * "cost": { * "price": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.00" * }, * "otherCharges": [] * } * } * ] * } * ] * }, * "buyerNote": "Please wrap it up as a present", * "buyerInfo": { * "contactId": "f7dc17a6-825a-466e-a78e-c4abea0217db", * "email": "Janedoe@example.com", * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873" * }, * "conversionCurrency": "USD", * "priceSummary": { * "subtotal": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "shipping": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.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": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.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": [ * { * "value": "12345", * "title": "Tax ID", * "translatedTitle": "Tax ID" * } * ], * "weightUnit": "KG", * "currency": "USD", * "channelType": "WEB", * "siteLanguage": "en", * "buyerLanguage": "en", * "completed": false, * "taxIncludedInPrice": false, * "createdBy": { * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873" * }, * "_createdDate": "2022-10-26T10:55:56.759Z", * "_updatedDate": "2022-10-26T10:56:59.653Z", * "payNow": { * "subtotal": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "shipping": { * "amount": "10", * "convertedAmount": "10", * "formattedAmount": "$10.00", * "formattedConvertedAmount": "$10.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": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.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": [] * } * */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?