Creates a new coupon.
The createCoupon() function returns a Promise that resolves to an object containing the ID of
the new coupon after it has been successfully created.
When creating a coupon, the specified couponInfo object must
contain a value for exactly 1 of the following coupon properties. This
defines the coupon type.
"moneyOffAmount""percentOffRate""fixedPriceAmount""buyXGetY""freeShipping"When creating a new coupon, the specified couponInfo object must
contain values for name, code, startTime, and either scope or minimumSubtotal.
The exception is for a freeShipping coupon type, for which you cannot apply
a scope and minimumSubtotal is optional.
The coupon scope defines the items a coupon applies to. You can apply a coupon to all items in a specific Wix application, a group within the application, or a single item within a group.
The following table lists the currently supported coupon scopes:
| namespace | group | entityId | Result |
|---|---|---|---|
| stores | -- | -- | Applies to all store products |
| stores | product | product ID | Applies to the specific store product with the provided ID |
| stores | collection | collection ID | Applies to the specific store collection with the provided ID |
| bookings | -- | -- | Applies to all bookings services |
| bookings | service | service ID | Applies to the specific bookings service with the provided ID |
| events | event | event ID | Applies to the specific event with the provided ID |
| events | ticket | -- | Applies to all event tickets |
| events | ticket | ticket ID | Applies to the specific event ticket with the provided ID |
| pricingPlans | -- | -- | Applies to all pricing plans |
| pricingPlans | plan | plan ID | Applies to the specific pricing plan with the provided ID |
The information to use when creating the coupon.