It is written:
“If any man doesn't love the Lord Jesus Christ, let him be accursed. Come, Lord!” (1 Corinthians 16:22) (WEB).
The apostle Paul basically says that any man who does not love Jesus is accursed.
Obviously accursed people do not go to Heaven.
So loving Jesus by keeping His commandments is not optional.
Lets look at another Scripture.
Luke 10:25-28 says,
25 “And, behold, a certain lawyer stood up, and tempted him, saying, Master, what shall I do to inherit eternal life?
26 He said unto him, What is written in the law? how readest thou?
27 And he answering said, Thou shalt love the Lord thy God with all thy heart, and with all thy soul, and with all thy strength, and with all thy mind; and thy neighbour as thyself.
28 And he said unto him, Thou hast answered right: this do, and thou shalt live.”
To recap this passage above: A certain lawyer (a Jew) asked Jesus what shall he do to inherit eternal life. Jesus asked in return, how do you read what is written in the Law (or the Scriptures). The lawyer replied with quoting the two greatest commandments which is basically to love God (with some included details), and to love your neighbor. Jesus did correct the lawyer, and give the OSAS reply and say, “Wrong lawyer!” “Just believe in me, and my finished work, and do nothing and you shalt live.”
Is that what Jesus said? No. Most certainly not. Jesus said to the lawyer, you have answered right. This do, and you shall live (i.e. shall have eternal life).