Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda