On Drupal v6.24 and Ubercart 2.7, I'm trying to assign a trigger quantity for a product. It's for a school project in which we're tasked with created a "social buying" site. Ideally, when a user posts a product (a specific CCK content type set up as a product in Ubercart), they can set a minimum quantity and the orders aren't processed until that many people purchase it.

Here's an example in pseudocode. Let's say, for an example, the "trigger quantity" is 5 and the "max quantity" is 10...

When order is placed {
    If (# of orders on hold < 5) {
        Place current order on hold;
    }
    Else if (# of orders on hold = 5) {
        For each order on hold {
           Process order;
        }
        Process current order;
    }
    If (qty of product sold = (maxQty - 1)) {
        Process current order;
        Unpublish product node;
    }
}

Not quite sure how to do this. I placed a custom status in the order workflow to place orders on hold by default, but I can't set up a condition to check anything. Additionally, I can't actually move any orders out of this status for whatever reason, so I'm probably doing it wrong.

I'm brand new to Drupal and on an incredible time crunch, so please forgive me if this is an easily solved problem. I think the way to do this would be to use hook_ca_action and hook_ca_condition, but I honestly have no idea how that PHP would look.

Any ideas? Thanks in advance.