The coupons tab is where you can create, and delete coupons, as well as edit existing ones. Coupons, by default, are created one at a time in MemberMouse. However, there may be a situation where you need to create a large number of coupons at once. If you are familiar with PHP, coupons can be added to MemberMouse in bulk using a custom script.
Create A Large Number Of Coupons
To create a large number of coupons, you will need to use the following mySQL statement. Here's the insert SQL for inserting a single coupon:
INSERT INTO mm_coupons (`coupon_name`, `coupon_code`, `coupon_type`, `coupon_value`, `coupon_value_currency`, `description`, `quantity`, `start_date`, `end_date`, `recurring_billing_setting`, `date_modified`, `date_added`) VALUES (‘Sample Coupon’, ‘sample’, ‘percentage’, ‘20’, ‘USD’, NULL, ‘-1’, NOW(), NULL, ‘all’, NOW(), CURRENT_TIMESTAMP);
The three possible values for
While a 25% off coupons would have values like this:
Once you have your single coupon statement, you will need to write a simple PHP script, iterate over each coupon from a CSV file and run the insert query.
Adding Product Restrictions to Coupons
INSERT INTO `mm_coupon_restrictions` (`coupon_id`, `product_id`, `date_added`) VALUES ('<coupon_id>', '<product_id>', CURRENT_TIMESTAMP);
<coupon_id>with the ID of the desired coupon and
<product_id>with the ID of the desired product.