Search.../

removeCoupon( )

Removes the coupon currently applied to the cart.

Description

The removeCoupon() function returns a Promise that resolves to the current site visitor's cart when the currently applied coupon has been removed.

Note: When editing a site as a contributor, removeCoupon() will only work when viewing the live site.

Syntax

function removeCoupon(): Promise<CartObj>

removeCoupon Parameters

This function does not take any parameters.

Returns

Fulfilled - The updated cart.

Return Type:

Promise<CartObj>
NAME
TYPE
DESCRIPTION
_id
string

Unique identifier of the shopping cart.

appliedCoupon
CartAppliedCoupon

Coupon applied in the shopping cart.

billingAddress
CartAddress

Cart billing address.

buyerInfo
CartBuyerInfo

The buyer's information.

status
string

Cart status. Either "INCOMPLETE" or "COMPLETE".

currency
Currency

Currency of the shopping cart.

shippingInfo
CartShippingInfo

The shopping cart's shipping information.

lineItems
Array<CartLineItem>

Items in the shopping cart.

totals
OrderTotals

The shopping cart's totals.

weightUnit
string

The order's units of weight. One of: "KG", "LB", or "UNSPECIFIED_WEIGHT_UNIT".

Was this helpful?

Remove coupon from the cart

Copy Code
1import { cart } from 'wix-stores-frontend';
2
3cart.removeCoupon()
4 .then((updatedCart) => {
5 const cartId = updatedCart._id;
6 const cartLineItems = updatedCart.lineItems;
7 })
8 .catch((error) => {
9 console.error(error);
10 });
11
12
13/* Example of returned updatedCart object:
14 *
15 * {
16 * "_id": "b36eb035-635a-450e-b74d-acf86ee4dfcc",
17 * "appliedCoupon": "null",
18 * "billingAddress": {
19 * "firstName": "John",
20 * "lastName": "Doe",
21 * "email":"john.doe@somedomain.com",
22 * "phone":"5555555",
23 * "address":"235 West 23rd Street\nNew York, New York 10011\nUnited States"
24 * },
25 * "buyerNote": "This is a note from the buyer.",
26 * "buyerInfo":{
27 * "firstName": "John",
28 * "lastName": "Doe",
29 * "email": "john.doe@somedomain.com",
30 * "phone": "5555555555",
31 * "identityType": "CONTACT"
32 * },
33 * "status": "INCOMPLETE",
34 * "currency": {
35 * "code": "USD",
36 * "symbol": "$"
37 * },
38 * "shippingInfo": {
39 * "deliveryOption": "Free Shipping",
40 * "shippingAddress": {
41 * "firstName": "John",
42 * "lastName": "Doe",
43 * "email":"john.doe@somedomain.com",
44 * "phone":"5555555",
45 * "address":"235 West 23rd Street\nNew York, New York 10011\nUnited States"
46 * },
47 * "pickupDetails":null
48 * },
49 * "lineItems":[
50 * {
51 * "quantity": 1,
52 * "price": 120,
53 * "name": "A product",
54 * "productId": "a668ef33-f5b8-6569-d04c-1d123be68441",
55 * "totalPrice": 120,
56 * "lineItemType": "PHYSICAL",
57 * "customTextFields": [
58 * "title": "Custom Field",
59 * "value": "Custom value"
60 * ],
61 * "mediaItem": {
62 * "src": "wix:image://v1/a9ff3b_ed3b544c319b4fad9c222c791a997832.jpg/file.jpg#originWidth=1000&originHeight=1000",
63 * "type": "IMAGE"
64 * },
65 * "sku": "21554345656",
66 * "options": [ ],
67 * "weight": 3,
68 * "id": 1
69 * },
70 * {
71 * "quantity": 1,
72 * "price": 25,
73 * "name": "Another product",
74 * "productId": "1a2d7e83-4bef-31d5-09e1-3326ee271c09",
75 * "totalPrice": 25,
76 * "lineItemType": "PHYSICAL",
77 * "mediaItem": {
78 * "src": "wix:image://v1/a9ff3b_c6158b4d41784ae8b08337a331e1de7f.jpg/file.jpg#originWidth=1000&originHeight=1000",
79 * "type": "IMAGE"
80 * },
81 * "sku": "217537123517253",
82 * "options": [
83 * {
84 * "option": "Size",
85 * "selection": "Medium"
86 * },
87 * {
88 * "option": "Color",
89 * "selection": "Black"
90 * }
91 * ],
92 * "weight": 2,
93 * "id": 2
94 * }
95 * ],
96 * "totals": {
97 * "discount": 0,
98 * "quantity": 2,
99 * "shipping": 0,
100 * "subtotal": 145,
101 * "tax": 0,
102 * "total": 145,
103 * "weight": 5
104 * },
105 * "weightUnit": "LB"
106 * }
107 */