WooCommerce cart quantity won’t change after cart update

Solution:

To make it work everywhere with different settings based on specific products, try the following instead:

// General quantity settings
add_filter( 'woocommerce_quantity_input_args', 'custom_quantity_input_args', 10, 2 );
function custom_quantity_input_args( $args, $product ){
    $product_ids = array(27345, 27346);
    $condition   = in_array( $product->get_id(), $product_ids );

    if( ! is_cart() ) {
        $args['input_value'] = $condition ? 25 : 26; // Starting value
    }

    $args['min_value'] = $condition ? 25 : 26; // Minimum value
    $args['max_value'] = $condition ? 500 : 260; // Maximum value
    $args['step']      = $condition ? 25 : 26; // Step value

    return $args;
}

// For Ajax add to cart button (define the min and max value)
add_filter( 'woocommerce_loop_add_to_cart_args', 'custom_loop_add_to_cart_quantity_arg', 10, 2 );
function custom_loop_add_to_cart_quantity_arg( $args, $product ) {
    $product_ids = array(27345, 27346);
    $condition   = in_array( $product->get_id(), $product_ids );
    
    $args['quantity'] = $condition ? 25 : 26; // Min value

    return $args;
}

// For product variations (define the min value)
add_filter( 'woocommerce_available_variation', 'custom_available_variation_min_qty', 10, 3);
function custom_available_variation_min_qty( $data, $product, $variation ) {
    $product_ids = array(27345, 27346);
    $condition   = in_array( $product->get_id(), $product_ids );
    
    $args['min_qty'] = $condition ? 25 : 26; // Min value
    $args['max_qty'] = $condition ? 500 : 260; // Max value

    return $data;
}

Code goes in functions.php file of the active child theme (or active theme). Tested and works.