Gift Certificate Redeemable For Specific Item, One Time Use

Anyone know if there is a way to do this? Here's what I'm looking for:


  1. Unique code that can't be used by more than one customer (hence the use of GC instead of a coupon code)
  2. No cash value to the GC
  3. Makes a specific item in the customer's cart free (it's a digital item)
  4. Can't be reused / shared (see #1)



    CS Cart won't allow me to create gift certificates worth less than $10 but I figure I can satisfy #2 by tweaking the value of the GC in the database directly (setting it to $0.01).



    However, if the GC is worth $0.01 and the customer simply uses it to make the target product free, they won't ever zero out the GC and the code could be passed around to others.



    Any ideas?

I've made some progress on this via custom add-on. It hooks into calculate_cart_items and if the gift certificate being applied is worth $0.01 AND my target product is in the cart, it reduces the price of the target item to $0.01 (it's normally $24.99).



This seems to work correctly all the way through checkout and even updates the price back to $24.99 if the user removes the $0.01 gift certificate. However, I'm having a problem getting the price of the cart item on the checkout page to update after the user inputs (or removes) the gift certificate code. (see attachment)



If I hit recalculate it updates the price display and it also updates if I “Proceed to Checkout.” But how to get the item price display to update immediately after the gift certificate is applied?



Here is basically what I'm doing in my calculate_cart_items hook:



$cart['products'][$prod_id]['price'] = 0.01;
$cart['products'][$prod_id]['display_price'] = 0.01;
$cart['products'][$prod_id]['base_price'] = 0.01;
$cart['products'][$prod_id]['stored_price'] = 'Y';
$cart['recalculate'] = true;




The only thing I can think is that the calculate_cart_items hook is being called AFTER the cart items are parsed. Is there a different hook I can use to update the cart item prices before they're parsed? Or is there a way to duplicate the functionality of the “Recalculate” button without sending an ajax/http request since this seems to update the item price display?



[sharedmedia=core:attachments:7573]

cart_ss.jpg