The disciples that left did so because they didn’t believe Jesus was the Messiah nor did they believe his teachings from the beginning, Jesus said. This passage Jesus talks about wasn’t what made the ones that walked away unbelievers. They simply never believed.
24 When the people therefore saw that Jesus was not there, neither his disciples, they also took shipping, and came to Capernaum, seeking for Jesus.
25 And when they had found him on the other side of the sea, they said unto him, Rabbi, when camest thou hither?
26 Jesus answered them and said, Verily, verily, I say unto you, Ye seek me, not because ye saw the miracles, but because ye did eat of the loaves, and were filled.
27 Labour not for the meat which perisheth, but for that meat which endureth unto everlasting life, which the Son of man shall give unto you: for him hath God the Father sealed.
28 Then said they unto him, What shall we do, that we might work the works of God?
29 Jesus answered and said unto them, This is the work of God, that ye believe on him whom he hath sent.
30 They said therefore unto him, What sign shewest thou then, that we may see, and believe thee? what dost thou work?
31 Our fathers did eat manna in the desert; as it is written, He gave them bread from heaven to eat.
32 Then Jesus said unto them, Verily, verily, I say unto you, Moses gave you not that bread from heaven; but my Father giveth you the true bread from heaven.
33 For the bread of God is he which cometh down from heaven, and giveth life unto the world.
34 Then said they unto him, Lord, evermore give us this bread.
35 And Jesus said unto them, I am the bread of life: he that cometh to me shall never hunger; and he that believeth on me shall never thirst.
36 But I said unto you, That ye also have seen me, and believe not.
Not only did many of the disciples not believe but the multitude of people that just witnessed and was part of the miracle of loaves of bread and fishes not believe.
Jesus tells the multitude the same thing he told his disciples that it’s the belief in Jesus and his doctrine which is what gives eternal life. He says Labour not for the meat which perisheth. The human body and all flesh dies and perishes. He’s telling them to believe, nothing more. But they didn’t believe.
Verse 40. And this is the will of him that sent me, that every one which seeth the Son, and believeth on him, may have everlasting life: and I will raise him up at the last day.
Again, this is Jesus talking. If they just believe they may have everlasting life.
He repeats this again in verse 60 Verily, verily, I say unto you, He that believeth on me hath everlasting life.
51 I am the living bread which came down from heaven: if any man eat of this bread, he shall live for ever: and the bread that I will give is my flesh, which I will give for the life of the world
By sacrificing his life he is giving all the world a chance for eternal life because his death is the atonement for our sin. All that is required from us is belief in him.