• Resolved hf001

    (@hf001)


    Is there a way to call upon the number of order placed vs. how many left? So that I can display some sort of meter on the front end to let customers know there are only for example 5 out of 20 orders to place?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Steve Grunwell

    (@stevegrunwell)

    You can accomplish this by creating a new instance of Nexcess\LimitOrders\OrderLimiter:

    $limiter = new \Nexcess\LimitOrders\OrderLimiter();
    
    // Get the set limit.
    $limit = $limiter->get_limit();
    
    // Get the remaining orders.
    $remaining = $limiter->get_remaining_orders();
    
    // With these, calculate how many orders have been made.
    $orders = $limit - $remaining;
    
    // Alternately, you could use reflection:
    $method = new \ReflectionMethod($limiter, 'count_qualifying_orders');
    $method->setAccessible(true);
    $orders = $method->invoke($limiter);

    Hope that helps!

Viewing 1 replies (of 1 total)

The topic ‘Displaying an order meter’ is closed to new replies.