There is a problem with using only session, is that this default lasts very little time (in general the lifetime of a session is 24mins), I can put it in the cart now, I will talk/ask my girlfriend/mother/father... and in one/two hours it will be gone, in this scenario it is "bad" because there is very little room for manoeuvre (time) for the user to keep the "candidate" products to be bought. In this case the ideal would be to reinforce with cookies (your way is also correct, in the database and after 3 days these are deleted), or if you can, change the lifespan of the session as the colleague @Ttkdroid mentions in his reply (although this consumes resources on the server).
That said, then:
It actually depends on your needs, there is no rule for that, if you want to keep permanently what users thought, but did not purchase, you should enter in the database, if you want it to be only temporary you can just leave in session/cookies.
I believe that many systems, mainly the great keep this data permanently, for future functionalities (eg algorithms to know the interests and show results according to the categories of products that have already been in your cart and/or that you have already purchased) or simply for statistics, as fellow @Daniel Omine said may also help in strategic sales decisions.
It all depends on whether you think it’s worth it, you have support for, and what goals you’ll keep permanently.
Personally until today it was very rare to create a system in which to store the information of the cart in the database, simply because for the great part of the online stores this information would be wasted, that is, it would be data that would not have any purpose in the future and would only occupy disk space, and therefore not worth saving.
Thinking/weighing this, this decision is always in the hands of the programmers/responsible/system owners.
The first part of the answer is very imprecise. The second part is speculative. No decision can be made from it.
– Not The Real Hemingway
@Nottherealhemingway the first part is not to decide anything, it is just to talk about the session alone and point out a disadvantage, the doubt of the colleague goes around
– Miguel
@Nottherealhemingway is not to make any decision, none is wrong, depends on the needs. It is up to the responsible to weigh this and decide whether it is worth keeping permanently. There is no right or wrong, this decision is made depending on the system that will be worked
– Miguel
@Miguel’s answer is correct. What is "wrong", for the scope of the SO-pt site, is the question because it is based on opinions. Decisions that depend on the business model are based on opinion and this is reason to close a question. And that’s exactly what describes the answer. In general, the "right" way is to save the cart in a database even if the Cart is abandoned. This data is extremely important to understand the behavior of customers in various aspects and directly influence strategic sales decisions. It is a broad and very deep theme.
– Daniel Omine