uc_order_condition_total() checks $order->total.
uc_order_condition_subtotal() checks line item 'subtotal'.
But these 2 values may not be calculated yet at the time conditions are evaluated.
Conditions should calculate these values themselves when they are not available.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anrikun created an issue. See original summary.

anrikun’s picture

Status: Active » Needs review
FileSize
901 bytes

Here's a patch.

TR’s picture

Under what circumstances does this condition return the wrong answer?

anrikun’s picture

When shipping quotes get calculated on op prepare when order has just been created from cart items. At that point, total is always 0 and subtotal is not available yet.

TR’s picture

Component: Orders » Rules

Added Rules component.

TR’s picture

So why not always use uc_order_total() to get the total/subtotal in these actions, rather than using it only if our first choice fails?

I would much rather always go through a function call, to make sure all the hooks get invoked etc., rather than trying to access order variables directly and trying to calculate the total/subtotal in our own way in the action.

Does this patch work properly and solve the problem?