ModularMerchant
Knowledge Base
Shopping Cart Software Online Manual
Creating a link that applies a coupon code
Create tiered volume discounts for all products in a category Discount EVERY product (store-wide sale)
Location Home > Shopping Cart Software Components > Administration Area > Modules > Event Engine > FAQs & Tutorials

Creating a link that applies a coupon code

question
To help promote my latest product, I'm sending out an email batch to all of my customers, announcing the new product. I've also created a coupon code for a 25% discount on this product for the next week. Can I add a link to my email template, so that right from the email, customers can add the product to the basket AND apply the coupon code?

answer
Yes! The shopping cart automatically creates a set of "Add to Cart" links that may be used with any product, and even with combinations of multiple products. The shopping cart also supports certain URL variables, including one for coupon codes. Combining the coupon code URL variable with an "Add to Cart" link will result in a link that adds the product to the basket, and simultaneously applies the coupon code.

When an "Add to Cart" link contains the coupon_codes URL variable, accessing the link will add the specified product to the basket, apply the coupon code to the shopping session, and then load the destination page.

Before learning how to include the coupon_codes URL variable in "Add to Cart" links, it may be helpful to learn how to include the coupon_codes URL variable in less complicated links to store pages, such as a simple link to a product page.
 
Including the coupon_codes variable in a link to a store page

When a link to a store page contains the coupon_codes variable, clicking the link will load the store page... and when the store page loads, the shopping cart will automatically apply the coupon code referred to in the coupon_codes variable!

The basic structure of a link that includes the coupon_codes variable is as follows:
URL?coupon_codes=COUPON

URL indicates the page to load when the link is clicked, such as:
http://demostore.modularmerchant.com/zebra-plant-p161.php

coupon_codes=COUPON indicates which coupon code to apply when the above page is loaded, for instance:
coupon_codes=ZEBRA tells the shopping cart to apply the event which has the coupon code text ZEBRA.

try it!

Click the link below to open the "Zebra Plant" product page of the Modular Merchant demo store, and simultaneously apply the ZEBRA coupon code.

http://demostore.modularmerchant.com/zebra-plant-p161.php?coupon_codes=ZEBRA




The coupon_codes URL variable may even be used to apply multiple coupon codes at once! Simply add all of the coupon codes in a comma separated list.

The structure of a link that includes the coupon_codes variable with multiple coupons is as follows:
URL?coupon_codes=COUPON1,COUPON2,COUPON3

URL indicates the page to load when the link is clicked, such as:
http://demostore.modularmerchant.com/zebra-plant-p161.php

coupon_codes=COUPON1,COUPON2,COUPON3 indicates which coupon codes to apply when the above page is loaded, for instance:
coupon_codes=ZEBRA,FREESHIP tells the shopping cart to apply the event which has the coupon code text ZEBRA, and to apply the event which has the coupon code text FREESHIP.

If the store's Event Engine Module Settings are configured to restrict coupon usage to one coupon per order, then only the first coupon listed will be redeemed, and the shopping cart will ignore the rest of the list.

see it in action!

Click the link below to open the "Zebra Plant" product page of the Modular Merchant demo store, and simultaneously apply the ZEBRA coupon code and the FREESHIP coupon code.

http://demostore.modularmerchant.com/zebra-plant-p161.php?coupon_codes=ZEBRA,FREESHIP




The coupon_codes URL variable overrides any coupons that may have already been applied. If the customer already manually entered a coupon for free shipping, and then the link for a 50% off coupon, the free shipping coupon would be dropped from the order, and the 50% off coupon would be applied instead.

try it!

1. Click the link below to open the "Zebra Plant" product page of the Modular Merchant demo store:

http://demostore.modularmerchant.com/zebra-plant-p161.php

2. Add the "Zebra Plant" to the basket, and proceed to checkout.

3. On the checkout page, log in to the demo customer account:

Email demo@demo.com         

Password demo

4. Select a shipping method.

5. Then enter the coupon code FREESHIP and click the Submit Coupon Code.

6. The free shipping coupon has now been applied to the current demo order.

7. Next, click the link below to apply the ZEBRA coupon code to the same order:

https://demostore.modularmerchant.com/checkout.php?coupon_codes=ZEBRA

8. The ZEBRA coupon for a 50% discount on Zebra plants replaces the FREESHIP coupon code, with the result that the price of the Zebra plant in the order is reduced by 50%, and shipping is no longer free!




The coupon_codes URL variable is only compatible with coupon codes of active events. If an event has been deactivated, deleted, expired, or has already been redeemed the maximum number of times, it will not be applied to the order. Instead, an error message will be displayed, indicating that event is not available.

In this situation, if a valid coupon had already been applied to the order, attempting to apply the unavailable coupon code will not overwrite the currently active coupon code.

see it in action!

1. Click the link below to open the "Zebra Plant" product page of the Modular Merchant demo store, and simultaneously apply the ZEBRA coupon code.

http://demostore.modularmerchant.com/zebra-plant-p161.php?coupon_codes=ZEBRA

2. Now, click the next link to open the "Zebra Plant" product page again, this time attempting to apply the coupon code FALSEZEBRA, which does not actually correspond to any active event in the store:

http://demostore.modularmerchant.com/zebra-plant-p161.php?coupon_codes=FALSEZEBRA

3. The previously applied valid coupon code ZEBRA remains in effect, and an error message is displayed indicating that the new coupon code, FALSEZEBRA, is unavailable.

 
Including the coupon_codes variable in an "Add to Cart" link


recommended reading
Detailed explanations of "Add to Cart" links are available in the following Knowledge Base articles:
Using "Add to Cart" links on your website
Emptying a Customer's Basket Using "Add to Cart" links
Including additional variables in "Add to Cart" links

Including the coupon_codes variable in an "Add to Cart" link is a little more complicated, because "Add to Cart" links already include variables... that's how the shopping cart knows which product(s) to add to the cart when an "Add to Cart" link is accessed.

The basic structure of an "Add to Cart" link that includes the coupon_codes variable is as follows:
URL?id1=X&qty1=Y&coupon_codes=COUPON

URL indicates the page to load when the link is clicked, such as:
http://demostore.modularmerchant.com/quick_checkout.php

id1=X&qty1=Y indicates which product(s) to add to the basket, for instance:
id1=161&qty1=1 tells the shopping cart to add one unit of product SID 161 to the basket.

coupon_codes=COUPON indicates which coupon code to apply when the above page is loaded, for instance:
coupon_codes=ZEBRA tells the shopping cart to apply the event which has the coupon code text ZEBRA.

try it!

Click the "Add to Cart" link below to add a "Zebra Plant" to the cart in the Modular Merchant demo store and load the basket page, while at the same time applying the ZEBRA coupon code:

http://demostore.modularmerchant.com/quick_checkout.php?id1=161&qty1=1&coupon_codes=ZEBRA




— Last Edited - 11/26/2013 10:41am PST
Rank and add a comment to this article
Only logged in users may leave comments and rank articles. Log in to have your say!
  Knowledge Base Home

  QuickCode™ Tag Glossary

  Modular Merchant.com Homepage

Not Logged in.
Either Log in or create a User Account.

Other articles in this category...

Buy product X, get product Y free

Buy X products, get the lowest priced one free

Create a coupon code for X dollars/percent off product Y

Create a redeemable coupon code

Create coupons for a specific group of customers

Create tiered volume discounts for all products in a category

Creating a link that applies a coupon code

Discount EVERY product (store-wide sale)

Discount the order total when a certain product is purchased

Discount two products when BOTH are purchased together

Give a group of customers a discount

Give a specific customer a discount

Make the most expensive, of two or more products, free

Offer a discount for bulk purchases of product X

Offer free or reduced shipping with a coupon

Offer free shipping with minimum purchase

Product X discounted by Y amount if customer has a subscription to product Z

Product X discounted if customer has previously purchased Product Y

Products in category X discounted by Y amount if customer has a subscription to product Z

Purchase product X and receive a coupon for Y amount/percent

Put a product on sale

Put NEARLY All Products On Sale

Put products in a category on sale

Save X on orders over $Y

Spend $X, receive a $Y coupon

Subscribe customer to an autoresponder when they purchase a product