24/7 Support: 800.608.6482

Developer Docs

Template Language

Generate Coupon Docs


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)





Parameter Definitions:

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.

Debug Function:




Calling this function anywhere after a call to Generate_Coupon will output any errors registered during the coupon generation.


This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.


Copyright © 1997 – 2023 Miva©, Miva Merchant©, MivaPay©, MivaCon©, Camp Miva ℠, Miva, Inc. All Rights Reserved.