Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
How to apply woocommerce "place order" limit for a specific product per month

I want to set a limit on the number of orders a customer can send to a specific product per month on WooCommerce. The scenario is: I have a variable product, one feature is free and three features are paid. I want to limit its free feature. So that each user (guest or registered) can not place free orders more than 5 times per month. And when it exceeds the monthly limit, it will show him a message on the checkout page that he can not order the free product and must wait until next month or order the paid product. I found the following code but I think it is incomplete.

add_filter('woocommerce_is_purchasable', 'preventPurchaseIfOrderLimitReached', 10, 2);

function preventPurchaseIfOrderLimitReached($is_purchasable, $product)
{
    $OrderLimit = 5;
    $productId = $product->get_id();
    $quantityOrderedToday = getOrderAmount($productId);

    if ($quantityOrdered >= $OrderLimit) {
        $is_purchasable = false;
    }

    return $is_purchasable;
}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!