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 for a table of currently supported coupon scopes.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateCoupon(
_id: string,
specification: Specification,
fieldMask: Array<string>,
): Promise<void>;
ID of the coupon to update.
Coupon information to update.
Field mask of fields to update (required - passing an empty fieldMask
will return an error). Valid field masks are any of those in the specification
field.
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.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.