> 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`). > - 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: updateCoupon(_id: string, specification: Specification, fieldMask: Array) # Method package: wixMarketingV2 # Method menu location: wixMarketingV2 --> coupons --> updateCoupon # Method Link: https://dev.wix.com/docs/velo/apis/wix-marketing-v2/coupons/update-coupon.md # Method Description: Updates a coupon. The `updateCoupon()` function returns a Promise that resolves when the coupon is updated. Only the properties passed in the `specification` object will be updated. All other properties will remain the same. To remove a value from the coupon, pass its corresponding property with a value of `null`. When updating a coupon, you cannot change the coupon's `type`. For example, if the coupon's `type` is `moneyOffAmount`, you cannot change it to `fixedPriceAmount`. You can update the coupon type's value. For example, you can change the value of `moneyOffAmount` from `5` to `10`. The coupon `scope` defines the items a coupon applies to. A coupon can apply to all items in a specific Wix application, a group within the application, or a single item within a group. See the [introduction](#introduction) for a table of currently supported coupon scopes. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update an existing coupon (dashboard page code) ```javascript import { coupons } from 'wix-marketing.v2'; export function updateCoupon(_id, fieldMask, specification) { return coupons.updateCoupon(_id, fieldMask, specification); } // Returns a promise that is resolved when // the coupon is updated. ``` ## Update an existing coupon (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { coupons } from 'wix-marketing.v2'; export const updateCoupon = webMethod(Permissions.Admin, (params) => { const { _id, fieldMask, specification } = params; return coupons.updateCoupon(_id, fieldMask, specification); }); // Returns a promise that is resolved when // the coupon is updated. ``` ## Update a coupon's expiration date @description: ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { coupons } from 'wix-marketing.v2'; export const updateCoupon = webMethod(Permissions.Admin, () => { let _id = "bff1f257-5e7e-437d-9f86-098de337cae6"; let fieldMask = "expirationTime" let newExpirationDate = new Date(); newExpirationDate.setMonth(newExpirationDate.getMonth() + 1); let specification = { "expirationTime": `${newExpirationDate.getTime()}` // Coupon ends in 1 month }; return coupons.updateCouponFields(_id, fieldMask, specification); }); // Returns a promise that is resolved when // the coupon is updated. ``` ---