Hi @atelierfelie,
Since version 1.3.0, this is indeed possible using the “limit_orders_pre_count_qualifying_orders” filter.
When a new order is received (or the transient that holds the current order count needs to be regenerated), the plugin calls OrderLimiter::count_qualifying_orders()
, which is responsible for counting the number of qualifying orders.
Using this filter, you can apply any arguments available via wc_get_orders()
, though some custom query logic may be required since WC_Order_Query
doesn’t appear to have a built-in parameter for filtering orders by products.
It’s worth mentioning, however, that this filter is only responsible for impacting the number of qualified orders; once the limit is hit, all ordering on the store will be impacted.
In other words, the filter can slow down how quickly you reach the limit, but it’ll still shut down ordering once the limit is reached.