The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

how to add coupon code on "actual" checkout page?

mikewendricksmikewendricks Member
in Bugs & Feature Requests edited May 2010
has anyone figured out how to do this as most people miss adding it when adding products to cart?
«1
Comments
  • lukeluke FoxyCart Team
    Not currently, but please vote for this request to be alerted when this is available: http://requests.foxycart.com/forums/4162-general-requests/suggestions/80807-make-shopping-cart-editable-in-checkout-screen?ref=title

    You may be able to solve this problem with some style changes to your cart and by showing the input form on page load with some JavaScript and/or CSS (instead of the customer having to click the link). Worth noting, there's some research out there that suggests add a coupon forms hurt your conversion rates since many customers leave your site in search of a coupon posted somewhere on the internet but never end up coming back.

    Good luck.
  • brettbrett FoxyCart Team
    @mikewendricks
    I actually did get this working...
    http://gist.github.com/291058

    I whipped it up for a user who wasn't doing shipping or tax, so that's VERY IMPORTANT TO NOTE. This code is being used by one store but for all intents and purposes consider it UNTESTED, so make sure you test it thoroughly, as it might not work with your specific settings.
  • lukeluke FoxyCart Team
    Uh oh... Brett's been coding again. Look out everyone. :)
  • I'm charging for products so it appears it won't work, also charge tax for IL orders! Keep coding amigo!
  • brettbrett FoxyCart Team
    So to clarify: You're using tax, so that'd be the problem? You might want to try that code anyway at least to test. It'd still likely work, though it might not update the taxes after the code is entered, so the correct tax amount would be on the receipt. Then again, it might. Sorry, I'd test it for you if I wasn't in the middle of way too many things right now. If you do try it and need help just let me know.
  • Brett - thanks for the code snippet. I added it to my checkout (http://kpelements.com/buy) and it shows up, but the coupon application process is a little wonky. I enter a coupon code (try E1R79AQ27C) and it gets successfully added to the cart, however there is a $0.00 dollar amount (it should be 10% off). I know the coupon is setup correctly, because if I refresh the checkout page after adding the coupon, the correct discount shows up. Any idea how to make it work without the manual page refresh?
  • brettbrett FoxyCart Team
    Give this new one a go:
    https://gist.github.com/749350

    It's got a few improvements as well, and is currently set up to both hide the "apply coupon" on pageload if a coupon is already there, and to hide it once a coupon has been added (to prevent the impression that multiple coupons can be entered).

    You can read through the comments to change either of those behaviors if you want.
  • brettbrett FoxyCart Team
    Oh, also, check the latest Google Analytics documentation. Just made a change that impacts this section:
    <script type="text/javascript" charset="utf-8">
    		if (window.location.hash.search(/utma/) == -1 && fc_json.custom_fields['ga'].length > 0) {
    			window.location.hash = fc_json.custom_fields['ga'];
    			console.info(window.location.hash);
    		}
    	</script>
    
    Minor change but should fail better just in case something gets weird.
  • As far as the coupon .7 code, once it's added, no discount is showing up?

    I'll whisper a test URL and a coupon code but once I hit apply nothing happens. If I refresh, I see the "Add a coupon" link again and if I enter it again it gives me a warning about it already being added. But the total isn't updated.

    There are no taxes/shipping.
  • Awesome, that works Brett. Very slick, I really appreciate it.
  • Thanks Luke and Brett for sorting me out. As @BillDA says, it's very slick and works. I apparently don't know how to setup coupons properly =P
  • brettbrett FoxyCart Team
    http://wiki.foxycart.com/static/redirect/coupons

    That's new documentation, but we'd love feedback, @panhead490

    @all: Neato. Glad it's working. Again, be careful with taxes and shipping, but we're happy to help.
  • Hello -
    Implemented this script in my cart, but am getting an error in IE 7/8

    Line 13:
    coupon = jQuery('#fc_coupon').val();
    

    seems to be tripping up IE with an 'object doesn't support this property or method' error.
    Looked around for a while and tried to use standard javascript, with no luck.

    Any ideas? For now I turned it off on IE.
    Any help here would be great!

    Thanks
    Rich
  • fc_adamfc_adam FoxyCart Team
    @Rich, could you link us to the store this is on?
  • Hey Adam,

    Its at http://shopcoobie.com on the checkout page.
    Thanks
    Rich
  • fc_adamfc_adam FoxyCart Team
    @Rich,

    Can you give this one a go please? http://pastie.org/pastes/2373381
  • Hi there... I'm gonna pipe in with another issue.

    I've been using the info in this post on my store for some time now, but was oblivious to the fact that its not working on IE 7/8 at all. IE9 works fine. Any thoughts on why?

    I know this is not intended for a live site.. did I miss somewhere the official way to add a "coupon field" to my checkout page for customers to enter coupon codes?

    Thanks!
  • fc_adamfc_adam FoxyCart Team
    @keeneyemedia,

    Where did you get the code from? There was an issue with IE6/7 that Rich found, which I fixed in my previous post. Can you perhaps try that code?
  • Adam,

    I used that pastie code from 8-14. It appeared to still not work, so I just made some overwriting CSS so it only displays on the cart, not on the actual checkout page.

    That works currently as I'm offering free shipping. But if in the future if I go back to my javascript shipping rates, I'll need a solution to work on the checkout page. But I'm not gonna worry about crossing that bridge yet.

    Thanks
  • fc_adamfc_adam FoxyCart Team
    @keeneyemedia,

    Could you link to the store you've got this code on? The code I posted I was testing in IE7 and it was working fine. Something else must be at play here but I'll need to see it in action to know.
  • Sure thing: its at http://kathrynthegrape.com/index.php/store

    I'm running several javascript modifications on the store as well as the Acme Cart beta store for ExpressionEngine and its gotten a little messy.
  • fc_adamfc_adam FoxyCart Team
    @keeneyemedia,

    You have a javascript error on your checkout that may be interfering with the coupon code script. Try changing this line:
    var couponfield = $("#fc_coupon").data();
    
    to
    var couponfield = $("#fc_coupon");
    
  • Thanks for grabbin that.

    I made that change but I'm not gonna mess with it anymore. Its working right now so I'd like to leave it be. :)
  • I'm interested in a fully functional Add Coupon in the checkout page as I am not using a cart. Posted to the request thing up top as well.
  • fc_adamfc_adam FoxyCart Team
    @versatil,

    Did you see the code for adding that type of functionality to the checkout as well on our snippets page? http://wiki.foxycart.com/snippets/start ?
  • I didn't try that, I just sort of assumed the pasties link above was more recent. That was my fault. I will give the snippet a whirl tomorrow, thank you!
  • fc_adamfc_adam FoxyCart Team
    @versatil,

    Ah actually you're right, that pastie I included above is more recent. I thought the page had been updated - I'll update that now.
  • I'm coming back to this thread.. looks like my coupon code is destroying all of my shipping settings.

    Without a coupon entered, all my shipping works perfect. When I add a coupon, its as if the entire shipping functions don't even begin to kick in. Any thoughts? (http://www.kathrynthegrape.com/index.php/store)
  • Woops... posted too soon. But for anyone else, I had to include my coupon js code last - after my other shipping settings. Seems to be working now.
  • lancelance Member, Community Support Member
    @keeneyemedia -

    Thanks for posting your update! Glad this is working for you now.

    Lance
Sign In or Register to comment.