In chapter 21 of The Little Prince by Antoine de Saint-Exupery, this piece of in-depth advice is shared with the prince by a fox. The prince was somewhat exasperated by the encounters he had with flowers and even by the fox's requests to be tamed.
After he tamed the fox, the prince was preparing to leave when the animal told him that he would cry. The prince was somewhat confused by the remark and told the fox that he brought his sadness upon himself. At this, the fox told him that it was indeed so, but that it was better. He then told the perplexed prince that he would share a secret with him if the prince went back to look at the roses and came to say goodbye.
When the prince returned, the fox shared the quote with him:
It is only in the heart that one can see rightly, what is essential is invisible to the eye.
What this means is that the true nature of things can only be seen and understood if one perceives it with feeling. This suggests passion and care, which the fox experienced when the prince tamed him. The flowers did not experience any of that since their perception was limited. They saw only themselves and their beauty; because of their numbers, they could not be truly loved. There was no real depth to what was felt and, therefore, the prince could not care much for them, either.
The fox is saying that what one sees is not necessarily what one loves, for the perception has no depth and is shallow and meaningless. One needs to feel something for something else to truly understand and appreciate it, as he did for the little prince. They had developed a relationship and, thus, the fox's perception of the prince changed. He felt sorrowful about the prince leaving, as he had grown to care about him.
Simply put, it is what one feels that is the most important, not just what one sees.