Note: If no parameters are passed, the function will use the configuration options set in the admin.
This function has 7 parameters which can be used to override the page default settings.
eligibility (valid values are X, A, or L for Current Customer, All Shoppers, or All Logged In Customers)
Code – This is the prefix you want the code to start with. It will automatically be appended with random alphanumeric characters.
Eligibility – There are three options here
Discount To Apply – This is the price group (discount) the coupon will reference
Limit Eligibility – Number of days coupon is valid for, starting on the time it was generated
Max Use (Total) – Total number of times the coupon can be used
Max Use (Per Shopper) – Total number of time a unique shopper can use the coupon
Calling Generate_Coupon() without parameters will generate a coupon using the configuration on the Generate Coupon tab. To override these settings for additional coupons pass the first six parameters listed above to the function. By default, all of the generated coupon data is stored in the l.settings:generatecoupon:coupon variable. Optionally, you may save the coupon details to a custom variable by passing the variable name as the seventh parameter.
Calling this function anywhere after a call to Generate_Coupon will output any errors registered during the coupon generation.