I want to see the mysql query when adding a product to the cart. I have referred this link, How to log all Magento 2 SQL queries? but I need query only for cart.
How to get the query for cart events? Can anyone please guide?
Thanks in advance!
I want to see the mysql query when adding a product to the cart. I have referred this link, How to log all Magento 2 SQL queries? but I need query only for cart.
How to get the query for cart events? Can anyone please guide?
Thanks in advance!
I think you should look at adding some logging to the \Magento\Quote\Model\Quote::addProduct
method.
If you want to log the MySQL commands server-side, you might have to add logging at a very low level. After adding items to the quote entity, the quote will be saved to the database via \Magento\Framework\Model\ResourceModel\Db\AbstractDb::save
method. This method is used to save all entities to the database though, so you'll have to be very defensive in your logging etc.