Context context context.
The "whole matter" being the content which "The Teacher" had been going on about.
It's often believed that this little bit of positivity added to the end of Ecclesiastes is an amendation from a later editor, given the immense pessimism of the text. Giving a, "So if everything is so meaningless in life, what does matter?" Well, what does matter, from a Jewish perspective, is honoring God and observing God's Torah. Since observing Torah is the covenant identity of the Jewish people. But wanna take a guess as to what the point of the covenant, the point of the Torah, is?
Just curious, are you really trying to argue that keeping commandments is more important than Jesus? Because if that's really what you are trying to argue here, then that certainly speaks volumes. And it's not good.
-CryptoLutheran
Without the atonement no one would be saved. That being said let us review what Jesus had to say about the commandments:
(New Testament | John 14:15 - 24)
15 ¶ If ye love me, keep my commandments.
16 And I will pray the Father, and he shall give you another Comforter, that he may abide with you for ever;
17 Even the Spirit of truth; whom the world cannot receive, because it seeth him not, neither knoweth him: but ye know him; for he dwelleth with you, and shall be in you.
18 I will not leave you comfortless: I will come to you.
19 Yet a little while, and the world seeth me no more; but ye see me: because I live, ye shall live also.
20 At that day ye shall know that I am in my Father, and ye in me, and I in you.
21 He that hath my commandments, and keepeth them, he it is that loveth me: and he that loveth me shall be loved of my Father, and I will love him, and will manifest myself to him.
22 Judas saith unto him, not Iscariot, Lord, how is it that thou wilt manifest thyself unto us, and not unto the world?
23 Jesus answered and said unto him, If a man love me, he will keep my words: and my Father will love him, and we will come unto him, and make our abode with him.
24 He that loveth me not keepeth not my sayings: and the word which ye hear is not mine, but the Father's which sent me.