function validate(coupon) { codes = new When you click, validate() gets called, with no parameter, so coupon is undefined. Coupon" name="Submit"." />

Javascript coupon code script

These are then automatically checked for their content into the second script. I think it already does whatever you are asking for? Just place "dc" with whatever coupon code you want and ensure that you are using the URL Parameters function as well. As far as sending it without the page refresh, I don't think that works. It looks like I have to add all possible inbound coupon codes to the script, right?

WHAT I was hoping to do - apply a new coupon code without having to edit the script I tried to find a way to grab the couponcode as a variable and then replace the target coupon code val -- but this didn't work. This will permit my customer service team to make coupon codes for customers, and send them links, without going near the template or script. THAT would be super cool if possible, but beyond my jquery skill right now.

I tried moving the script to the footer, so that it is on all pages, and that did not work. If we are going to offer an inbound link to an empty shopping cart, that doesn't work either. WHAT IF we want to offer an inbound coupon code similar to an adcode so that the coupon is loaded from the first page load? Is this possible with this script? Hi Jeremy, pretty tired last night and wasn't thinking straight! I believe that putting in the coupon code from the link directly would work.

The reason I didn't initially was a security reason, I didn't want the coupon code directly in the URL. If someone wanted it, they could find it by reading the sourecode on the page but that was a lesser concern. Since you can't type in coupon codes for your team, it shouldn't matter. For us it was a different situation.

Paypal Coupon Code in PHP using PDO

It certainly shouldn't be a problem just storing the coupon code into a variable and then populating the rest of the script. I condensed the script. I think that the syntax should work, but you will need to test for errors. You should be able to call the variable in the. Try it out! I thought a little bit about your second question this morning. Then you use the cartdc variable to set a coupon code cookie for the session.

On the cart page, you read the coupon code cookie into a new variable and pass it into the function that applies it to the cart. I have done NO testing on this, so you will have to do it but I think it should work with some playing around. Hi Bryan, Wow. Awesome contributions here. Thank you. I quickly tested the. And this does not preserve past the first page load. I spent hours on this. PS -- to show the coupon code field this link is for our customer service or to give to a customer for special circumstances use this:.

Using a coupon checkout code in your emails

This is turning into a fun project -- but driving me up the wall -- it is just complicated enough to be a PITA! HOWEVER - 2 things: a still does the extra page load as you said, we can live with this ; b IF a customer tries to game the system and edits the URL parameter and inserts a coupon code that does not exist, this triggers an endless loop with a "not a valid coupon code" error. So there is some logic to the original idea of placing the permitted dc codes into the script, to prevent malicious or inadvertent dc code entires. IF the dc code is not exactly a permitted couponcode, then the script will not anything.

Implementing Your Own Coupon System for Standalone Charges

I think we have to do this, right? I think I figured out why the cookie is getting reset to undefined on every page load The script is trying to write a new cookie based on whatever is in the dc variable on every page load. And the script only knows the variable for the current page with the URL parameter.


  1. imats london freebies.
  2. We're Here To Help.
  3. foodpanda bangalore discount coupons;

We need to trap the Cookies. The cookie keeps reloading and shopping cart page keeps reloading with the "new" coupon code. I hired a js coder on Fiverr to help me sort out the page reload I hope this helps someone in the future. If anyone identifies a better way to accomplish any of this, please don't hesitate to share!!!

More advanced coupon system

A FEW NOTES: a If a crafty customer decides to test various coupon codes by changing the url parameter, once the first code is set in the cart, the script prevents further reloads to the coupon code but the crafty customer could clear cookies and try again. And it will be stuck there Please sign in to leave a comment. AmeriCommerce Status Update.

JavaScript Question: How do I Hide JavaScript Code?

John Lenertz August 15, Kathy Sechrist September 19, Jeremy Roberts March 06, July 23, Jeremy Roberts August 14, August 14, The content would be copied but only when on click function happens. If you see the functionality in any coupon site when you click on say Show Coupon Code or Reveal Code - it will not only show the code but will also copy the content and will take you to a specific site on click. Hence, mostly people use flash for such functionality but I do not wish to use flash and was wondering if multiple actions can happen on a single click? In this case it would be When a user clicks a specific div - lets say.

Now on clicking this the following things would happen a the click here to revel code is replaced with the actual coupon code.

How to Calculate Discount in Javascript

Yes, that all looks to be fairly straight forward. What in particular are you having trouble with? Are you wanting us to tell you how to write the scripting code to achieve that? Normally we help people with what they are currently working on. If you want someone to write it for you, we have a marketplace for that. The issue I am facing is multiple items are not working when there are say close to 20 such instances.

Like a coupon site - there are a list of codes so for each I need to assign the jquery. I am unable to do it for multiple items using single code. But like when I have 20 items I have to create 20 such queries which is not right according to me and should be managed in a simpler way. Those were my issues. Unfortunately copy to clipboard isn't something that javascript has access to in most browsers, so flash is still used for this feature.