php - Use minimum purchase quantity in quantities form WooCommerce Shop page

I'm using this plugin for minimum order quantities and quantity packaging for products on my website. I added this code to functions.php to show quantities next to the add to cart buttons with - and + buttons:

add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
    if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
        $html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
        $html .= woocommerce_quantity_input( array(), $product, false );
        $html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
        $html .= '</form>';
    }
    return $html;
}

This code works, it properly adds the package quantity every time when I click the + button. E.g. if the package quantity is '4', it now goes from 1 to 4, to 8, to 12, etc. and also back in steps of 4 when clicking the - button.

The only problem I have is that the quantity form always starts with '1' and I would like it to start with the minimum order quantity, e.g. 4. But this is of course different per product and not always required.

Any help would be much appreciated.

Answer

Solution:

I think you can try passing array instead of blank pass this

$args = array('min_value' => apply_filters( 'woocommerce_quantity_input_min', 4, $product ));

$html .= woocommerce_quantity_input( $args, $product, false );

Source