Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Set custom min/step not working

  • matisportowiec

    Hi! I am trying to use this code:

    function custom_minimum_order_quantity( $minimum, $product ) {
      // Check if the product has the tag "zestaw-4"
      if ( has_term( 'zestaw-4', 'product_tag', $product->get_id() ) ) {
        // Set the minimum order quantity to 4
        $minimum = 4;
      }
      // Return the minimum order quantity
      return $minimum;
    }
    add_filter( 'woocommerce_quantity_input_min', 'custom_minimum_order_quantity', 10, 2 );
    
    function custom_quantity_input_step( $step, $product ) {
      // Check if the product has the tag "zestaw-4"
      if ( has_term( 'zestaw-4', 'product_tag', $product->get_id() ) ) {
        // Set the step to 4 (only allow quantities that are multiples of 4)
        $step = 4;
      }
      // Return the step
      return $step;
    }
    add_filter( 'woocommerce_quantity_input_step', 'custom_quantity_input_step', 10, 2 );
    

    The min is set to 1:

    <input type="number" id="quantity_643803d8395e5" class="input-text qty text" name="quantity" value="4" title="Ilość" size="4" min="1" max="" step="4" placeholder="" inputmode="numeric" autocomplete="off">

    I’ve tried it on the other theme and it works:

    <input type="number" id="quantity_643806f026882" class="input-text qty text" name="quantity" value="8" title="Ilość" size="4" min="4" max="100" step="4" placeholder="" inputmode="numeric" autocomplete="off">

    Is GP altering it in any way?

  • Hi there.

    what happens if you disable the Quantity Buttons in Cutomizer > LAYOUT > Woocommerce ?

  • matisportowiec

    It’s the same. I’ve even tried on different GP shop and it’s the same.

  • Can you disable the WooCommerce module in GP Premium and see if that fixes the issue?
    https://docs.generatepress.com/article/installing-gp-premium/#activate-your-modules

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.