May 1, 2014 at 11:28 pm #10754ncarlingMember
I’ve figured out a way to pass a coupon code directly from a GET parameter into the shopping cart using the php function eStore_apply_discount(), but I’m wanting to take this a bit further, and am not sure if the functionality exists.
The workflow I’m going for is to send an email with a “discounted” link (or button – whatever), that sends the buyer to the product’s website, which is a standalone webpage, written in PHP (not part of the WordPress site where eStore lives). If they subsequently hit this page’s Add to Cart button, they’ll go to the cart, and a coupon code gets applied automatically.
I’m most of the way there, but am missing one piece. Here’s what I have so far:
1. link/button in email points to example.com/?pc=COUPONCODE
2. productsite.com grabs the GET param (PHP code), validates it (against my standards – less than N characters and only contains letters/numbers)
3. if everything looks ok, the PHP code stores the coupon in a hidden POST field (in the <form> where the add to cart button is at the bottom of the page). It also adds a cogratulatory note right above the button that says that a coupon has been detected and will be applied in the shopping cart.
4. User clicks Add to Cart, coupon code is sent to eStore shopping cart page (let’s say the URL is something like example.com/store/shopping-cart/ as a hidden POST param
5. shopping cart page grabs the coupon code, validates it and applies the coupon using the eStore_apply_discount() function.
This all works fine, but I’d like to take it one more step and have step 2 actually validate the coupon code against eStore’s list of coupons – last thing I want is for a buyer to try using an expired discount link and not find out the coupon’s no good until they get to the shopping cart (!).
Is there a way I can have PHP code on an external site reach into eStore and check a coupon code to make sure it’s valid (and for bonus points, bring back the discount terms – i.e., 10% or $5 off), so I can reflect the final pricing on the sales page itself, *before* the user clicks Add to Cart?
Unfortunately, I think this is a fairly simple question that I fear I’m asking in an overly-complex way… my apologies in advance…May 2, 2014 at 2:12 am #62670wzpModerator
Since the standalone page is “special,” why not have the button add a product that is identical in every way to the non discounted item; except the price?May 2, 2014 at 4:50 am #62671adminKeymaster
We don’t have an API to check the discount coupon code from an external site. We can do a custom job for this if you really need it:
- You must be logged in to reply to this topic.