When altering or submitting orders in the UberPOS extension for Ubercart, discounts do not get applied.

The reason seems to be that when UberPOS does something to an order, such as adding a product to it or finalizing it, it calls uc_order_save which triggers the "save" op / action for hook_order whereas the Discounts Alt module only calculates discount when the op / action is "submit".

Unfortunately, as far as I can tell from digging through the Ubercart documentation, there does not seem to be a method to trigger the op / action "submit" manually so unless there is something I'm missing, I can't really patch the UberPOS code to force calculating discounts whenever it modifies an order.

Would it be possible to extract the code that calculates discounts for an order from the implementation of hook_order into a separate function that I can then call from a patch to the UberPOS code?

(Yes, I'm aware that I could also patch the UberPOS code to invoke hook_order for the uc_discount_alt module only, but I'd prefer a cleaner solution).

Comments

jrust’s picture

Status: Active » Fixed

Good idea, this also cleans up the code for the admin order pane. There is now a uc_discounts_apply() function.

rhmtts’s picture

Thanks a lot for the fix!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.