Coupon Not Added To Cart with "Add To Cart"

c_headingc_heading Member
in Help edited December 2014
I've created a holiday promo as a coupon code that should be automatically applied when a customer adds a product to the cart. I've added the "coupon" parameter to my "Add To Cart" button link as described in the docs, but it is not being added.
Coupons can be added with a product add to cart link or form by specifying the coupon parameter with the coupon's code as the value.

The coupon code DOES work if entered manually in the sidecart or checkout, so we know the coupon code itself is valid and functional. Is there something wrong with my link URL, or is this a bug?
  • EDIT: I had an inspiration in the shower this morning.

    I'm using cart validation for the "Add To Cart" link with validation on all parameters. I removed the validation for the "coupon" parameter, and the coupon now DOES automatically apply.

    Please update the docs to state that the "coupon" url parameter must NOT have validation applied to it if cart validation is used.
  • fc_adamfc_adam FoxyCart Team
    edited April 2017

    I'm glad you were able to find the solution there. We do have a section on our link/form validation page on the wiki detailing the excluded pairs - I'll add some in-page links in other sections to make more of a note of them though.
  • @fc_adam,

    Thanks! I think just a quick parenthetical on the page where it describes adding it to the "Add to Cart" link like: "if using HMAC encryption, the coupon parameter should not be encrypted" would be enough. I would have seen the exception if I had checked the HMAC page, but it didn't occur to me until later that encryption was the reason the parameter wasn't working.
  • fc_adamfc_adam FoxyCart Team

    I had added a little note to the coupons page - but I've just made that a bit clearer by pulling into an info pullout. Thanks for the suggestion.
Sign In or Register to comment.