Hi, I realize this is a very random and specific problem, but it seems like “MinimumSubtotal” is not the correct parameter for the createCoupon function. I can’t find anything on this topic, so I’m hoping someone can help before our next farming season starts and customers start needing to create coupons! (lol, like next week;)
Here’s my backend module.
import wixData from 'wix-data';
import { coupons } from 'wix-marketing-backend';
export async function createMyCouponModule(VARIABLE) {
wixData.query("CouponCodes")
.eq("_id",VARIABLE)
.find()
.then((results) => {
let code = results.items[0].code;
let name = results.items[0].customer;
let amount = results.items[0].amount;
let expirationDate = new Date();
expirationDate.setMonth(expirationDate.getMonth() + 12);
let minimumSubtotal = 2;
console.log(name);
console.log(code);
console.log(amount);
let couponInfo = {
"name": name,
"code": code,
"startTime": new Date(),
"expirationTime": expirationDate,
"active": true,
"minimumSubtotal": minimumSubtotal,
"scope": {
"namespace": "stores"
},
"moneyOffAmount": amount // defined in frontend code
};
return coupons.createCoupon(couponInfo);
});
}
Everything else like name, code, startTime, expirationTime, and MoneyOffAmount is working fine. I’ve checked the “Marketing/Coupons” DB and the Minimum Subtotal field name is the same (and is set to number.) …any ideas? We’ll send you some fresh veggies from our farm!