ShopSite Tip – Coupon Code Pop-Up

JavaScript can be used for a variety of features on the Shopping Cart page in ShopSite, such as this tip for showing the amount left to purchase to receive free shipping, and today we’re going to look at a very simple piece of code which will pop-up an alert to the customer with a coupon code.

Add This Coupon Code!

ShopSite has a large list of javascript variables which are available on the Shopping Cart for custom scripts, and we’ll use the “ss_subtotal” variable for this code.

<!-- Coupon Code After Cart Minimum -->
<script language="javascript" type="text/javascript">
coupon_limit = 500.00;
if (ss_subtotal >= coupon_limit){document.write('<strong>Guess What! Add coupon code "5off" to save 5% on your order!</strong>');}


– Change the “coupon_limit” value to the minimum value you want the customer to have in the cart before the message appears.
– Update the text in the “document.write” line with the message you want to tell the customer and be sure that you include the coupon code you want them to enter.

Add The Script

That’s all there is to the script.  The next step is to place it where you want the message to appear.  This can be done by editing your shopping cart template, or you could test it by just adding the code to the Commerce Setup > Order System > Shopping Cart > “Text at the top of the Shopping Cart screen” field.

Most templates will display that field on the Shopping Cart screen.

For a working sample, click here to add a product to our demo store and as long as there is more than $500 in the cart a message will appear showing the coupon code to enter.  Once you’re on the cart change the quantity to 2 for that product and the message will appear.

Advanced Options

Since there are javascript variables for a variety of values, your developer could implement additional features to the code.  For example you could have it only appear if there were specific SKUs in the cart, or if there are no other coupons, or if a certain minimum quantity is in the cart – the possibilities are endless!


Looking for a web host that understands ecommerce and business hosting?
Check us out today!

Leave a Reply