24/7 Support: 800.608.6482

Get Started

Developer Docs

Generate Coupon Docs

Function:

Note: If no parameters are passed, the function will use the configuration options set in the admin.

Parameters:

This function has 7 parameters which can be used to override the page default settings.

pricegroup_name

code_prefix

eligibility (valid values are X, A, or L for Current Customer, All Shoppers, or All Logged In Customers)

limit

maxusetot

maxuseshp

storage_variable

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

  • Current Customer – The custom MUST be logged in at the time the coupon is generated for this to work. It will generate a coupon tied to that specific customer. If this is selected and the customer is not logged in, no coupon will be generated.
  • All Shoppers – Any shopper can use the coupon up to the Max Use / Max User Per Shopper settings
  • All Logged In Customers – Any customer who is logged in can use the coupon

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

Description:

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:

Parameters:

(none)

Description:

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

Examples:

Miva believes that all online businesses should have access to a scalable ecommerce platform that can meet their unique business requirements. Miva offers PCI compliant ecommerce, hosting, and custom website design and development solutions. Miva customers have processed over $100 billion in online sales since 1997.

Copyright © 2016 Miva, Inc - All Rights Reserved   Privacy Policy | Store Policy

Links
Contact Us
Receive Tips & Updates

Copyright © 2016 Miva, Inc - All Rights Reserved

Back To The Top