The coupons tab is where you will 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.  If you are familiar with PHP, that can be done in MemberMouse.


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`, 
`description`, `quantity`, `start_date`, `end_date`, `recurring_billing_setting`, `date_modified`, `date_added`)
 VALUES ('Sample Coupon', 'sample', 'percentage', '20', NULL, '-1', NOW(), '', 'all', NOW(), 
CURRENT_TIMESTAMP);

  

The three possible values for coupon_type are:

  • percentage
  • dollar
  • free

So a $10 off coupon would have values like this:

'dollar', '10',

While a 25% off coupons would have values like this:

'percentage', '25',

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


If you need to add product restrictions to your coupons to ensure that they can only be used for particular products you can use the following query:


INSERT INTO `mm_coupon_restrictions` (`coupon_id`, `product_id`, `date_added`) VALUES 
('<coupon_id>', '<product_id>', CURRENT_TIMESTAMP);

  

Just replace <coupon_id> with the ID of the desired coupon and <product_id> with the ID of the desired product.