• Welcome to KonaKart Community Forum. Please login or sign up.
 

coupon "times used" not updated

Started by impiastro, September 14, 2010, 09:39:21 am

Previous topic - Next topic

impiastro

Hi everyone, have you ever experienced this issue?

I'm collecting the coupon code during the checkout process.
I set the collected coupon code using the order.setCouponCode() before saving the order (using the method saveOrder()) and I can see the order discount is applied correctly and the order is saved in the orders table with the correct coupon_ids but the value of times_used is not decremented.
It says always 0 times used (both from konakartadmin app and from coupon table).

Should I decrement the coupon "times used" field manually?

I'm using KK version 4.1.0.0.

Thanks for your precious time,

ROb

trevor

The times_used field gets decremented once the order has been paid for and not when it is saved.

The API call which triggers it is updateInventory().

impiastro

Thank you Trevor, but what about a order of final price 0 when the coupon is applied?

For example: final order total 100, coupon value 100, final price 0.

The order will not be paid by customer because its price is 0.

Another question, when updateInventory() API is called? During the order change status to payed?

ROb

trevor

If you look at the action classes like AuthorizeNet.java you'll see that it gets called when the payment is approved. However you can call it from anywhere to suit your business needs.

impiastro

OK, perfect.

But in this way it's possible to generate 4 orders with the same coupon id (even if it can used only once), receiving also the coupon discount, and pay all of them later.

In this scenario will the updateInventory function give an error during coupon times used decrement or not?

Don't you think it could be more safe to decrement the times used field after order creation?

ROb

trevor

Once the coupon has been used once and the times_used attribute is incremented by calling updateInventory(), then it will no longer activate the promotion in other orders.

impiastro

OK, Trevor.

Thank you for your attention!

ROb


impiastro

Just an update.

The function updateInventory() after order creation works as expected.
The coupon "times used" was correctly decremented.

We have choosen to update coupon usage number just after order confirmation and not after order payment.

Thanks to Trevor and all KK Community.