The coupons API allows you to create, view, update, and delete individual, or a batch, of coupon codes.
This API helps you to create a new coupon.
@required String code,
@required String discountType,
@required String amount,
@required bool individualUse,
@required bool excludeSaleItems,
@required String minimumAmount,
// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};
// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
wcStore.createCoupon({
code,
discountType,
amount,
individualUse,
excludeSaleItems,
minimumAmount,
}).then( (coupon) {
print(coupon.toJson());
});
});
Coupon instance
Represents the following object - WooCommerce Coupon
This API lets you retrieve and view a specific coupon by ID.
int id
// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};
// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
wcStore.retrieveCoupons({int id}).then( (coupon) {
print(coupon.toJson());
});
});
Coupon instance
Represents the following object - WooCommerce Coupon
This API helps you to list all the coupons that have been created.
String context
int page
int perPage
String search
String after
String before
List<int> exclude
List<int> include
String order
String orderby
String code
// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};
// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
wcStore.getCoupons({}).then( (coupons) {
print(coupons.toString());
});
});
List<Coupon> instance
Represents the following object - WooCommerce Coupon List
This API lets you make changes to a coupon.
int id,
{Map<String, dynamic> data}
// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};
// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
wcStore.updateCoupon(int id, {Map<String, dynamic> data}).then( (coupon) {
print(coupon.toJson());
});
});
List<Coupon> instance
Represents the following object - WooCommerce Coupon
This API helps you delete a coupon.
int id
// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};
// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
wcStore.deleteCoupon(int id).then( (coupon) {
print(coupon.toJson());
});
});
List<Coupon> instance
Represents the following object - WooCommerce Coupon
This API helps you to batch create, update and delete multiple coupons.
Map<String, dynamic> data
// CONFIG FOR WOOSIGNAL
var wsConfig = {
"appKey":"your app key",
"debugMode":true
};
// CREATING AN INSTANCE
WooSignal.getInstance(config: wsConfig).then( (wcStore) {
wcStore.batchCoupon(data: {}).then( (couponBatch) {
print(couponBatch.toJson());
});
});
List<CouponBatch> instance
Represents the following object - WooCommerce CouponBatch