Droplet - Populate discount_code with JS Cookie or Variable using JS

edited June 2016 in Developers
Hi Peeps!

I am trying to populate the Droplet ‘discount_code:’ field with either a global variable or cookie ...

I can’t use the PHP get cookie function, since the droplet will be published on a page with super cache, wondering if you had some advice? ... 

Mission pre-populate the voucher field from a cookie populated from a query string.

Any advice?



  • Never mind, I am an idiot :)
  • I am still having issues with this, thought I solved it!

  • NickNick Checkfront

    Thanks for using the forums 

    Would it perhaps work to store the discount code in the user's session, and retrieve it prior to page load to populate the droplet field? this way, you could use PHP echo to output a droplet containing the discount code as needed 

    I hope that helps. Please let us know if there is more we can do to help, or feel free to email us at support@checkfront.com.


    Nick Dronsfield
    Checkfront Support Team  
  • Hi Nick,

    Thanks for replying. 

    The website is compressed with WP Rocket, basically an HTML file at the end, that's why echoing PHP won't work.

    I could easily not cache those pages, but with a site that sells as much as we do, caching is key.

    That's why I was hoping JS would solve this. PS I am also going to modify the tid to include the source from marketing campaigns using this same method (if I ever solve it).

Sign In or Register to comment.