removeGiftCard( )


Removes the gift card from a specified checkout.

The removeGiftCard() function returns a Promise that resolves to the updated checkout when the gift card is removed from the specified checkout.

Note: A checkout can only hold 1 gift card.

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

ID of the checkout to remove the gift card from.

Returns
Return Type:Promise<RemoveGiftCardResponse>
JavaScript
/************************************** * Backend code - my-backend-file.jsw * **************************************/ import { checkout } from "wix-ecom-backend"; export async function myRemoveGiftCardFunction(checkoutId) { try { const updatedCheckout = await checkout.removeGiftCard(checkoutId); console.log("Success! Removed gift card from checkout:", updatedCheckout); return updatedCheckout; } catch (error) { console.error(error); // Handle the error } } /************* * Page code * ************/ import { myRemoveGiftCardFunction } from "backend/my-backend-file"; // Sample checkoutId: const checkoutId = "84d74a0e-5c3c-4113-8bd2-d264cc60d82a"; myRemoveGiftCardFunction(checkoutId) .then((updatedCheckout) => { const checkoutId = updatedCheckout._id; const totalPrice = updatedCheckout.priceSummary.total; console.log("Success! Removed gift card from checkout:", updatedCheckout); return updatedCheckout; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * { * "_id": "84d74a0e-5c3c-4113-8bd2-d264cc60d82a", * "lineItems": [ * { * "_id": "00000000-0000-0000-0000-000000000001", * "quantity": 1, * "catalogReference": { * "catalogItemId": "1a2d7e83-4bef-31d5-09e1-3326ee271c09", * "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e", * "options": { * "variantId": "132b84e8-aab8-47a1-a1f6-2c47557b64a4" * } * }, * "productName": { * "original": "Watch", * "translated": "Watch" * }, * "url": "https://example.wixsite.com", * "price": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "lineItemPrice": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "fullPrice": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "priceBeforeDiscounts": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "totalPriceAfterTax": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "totalPriceBeforeTax": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "taxDetails": { * "taxableAmount": { * "amount": "30", * "convertedAmount": "30", * "formattedAmount": "$30.00", * "formattedConvertedAmount": "$30.00" * }, * "taxRate": "0", * "totalTax": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "rateBreakdown": [] * }, * "discount": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "descriptionLines": [ * { * "name": { * "original": "Size", * "translated": "Size" * }, * "plainText": { * "original": "Medium", * "translated": "Medium" * }, * "lineType": "PLAIN_TEXT", * "plainTextValue": { * "original": "Medium", * "translated": "Medium" * } * }, * { * "name": { * "original": "Color", * "translated": "Color" * }, * "colorInfo": { * "original": "Grey", * "translated": "Grey", * "code": "rgb(128, 128, 128)" * }, * "lineType": "COLOR", * "color": "Grey" * } * ], * "media": "wix:image://v1/3c76e2_8891bbe3372a428aac976ac59aa0ac74~mv2.jpg#originWidth=1000&originHeight=1000", * "availability": { * "status": "AVAILABLE" * }, * "physicalProperties": { * "sku": "217537123517253", * "shippable": true * }, * "couponScopes": [ * { * "namespace": "stores", * "group": { * "name": "collection", * "entityId": "00000000-000000-000000-000000000001" * } * }, * { * "namespace": "stores", * "group": { * "name": "product", * "entityId": "1a2d7e83-4bef-31d5-09e1-3326ee271c09" * } * } * ], * "itemType": { * "preset": "PHYSICAL" * }, * "paymentOption": "FULL_PAYMENT_ONLINE", * "rootCatalogItemId": "1a2d7e83-4bef-31d5-09e1-3326ee271c09" * } * ], * "billingInfo": { * "address": { * "addressLine1": "525 5th Avenue", * "city": "New York", * "subdivision": "US-NY", * "country": "US", * "postalCode": "10173" * }, * "contactDetails": { * "firstName": "Jane", * "lastName": "Doe", * "phone": "0555555555" * } * }, * "shippingInfo": { * "shippingDestination": { * "address": { * "addressLine1": "525 5th Avenue", * "city": "New York", * "subdivision": "US-NY", * "country": "US", * "postalCode": "10173" * }, * "contactDetails": { * "firstName": "Jane", * "lastName": "Doe", * "phone": "0555555555" * } * }, * "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": [] * } * } * ] * } * ] * }, * "buyerInfo": { * "contactId": "24de6f0b-60ce-4faa-9138-2e39f1415615", * "email": "janedoe@gmail.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": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "total": { * "amount": "40", * "convertedAmount": "40", * "formattedAmount": "$40.00", * "formattedConvertedAmount": "$40.00" * }, * "additionalFees": { * "amount": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * } * }, * "calculationErrors": { * "orderValidationErrors": [] * }, * "appliedDiscounts": [], * "customFields": [], * "weightUnit": "KG", * "currency": "USD", * "channelType": "WEB", * "siteLanguage": "en", * "buyerLanguage": "en", * "completed": false, * "taxIncludedInPrice": false, * "createdBy": { * "visitorId": "4c7ce95c-9fb3-417d-9f02-b41e82b841f7" * }, * "_createdDate": "2022-10-27T08:51:44.099Z", * "_updatedDate": "2022-10-27T08:54:53.785Z", * "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": "0", * "convertedAmount": "0", * "formattedAmount": "$0.00", * "formattedConvertedAmount": "$0.00" * }, * "total": { * "amount": "40", * "convertedAmount": "40", * "formattedAmount": "$40.00", * "formattedConvertedAmount": "$40.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": [], * "cartId": "d7aca608-cbbd-4a22-9813-0459992abd1f" * } * */
Errors

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

Did this help?