[Update]
The problem has been solved but I will leave the topic for other people. Everything was working fine all day, but suddenly, for no reason, the product could not be added to the cart. After analysis, it turned out that wordpress released an update to version 6.2.2 for me and the update fixed the problem.