i want customer only add single item in her cart with any number of quantity. if cart already have item it's should be remove and newly added item add to cart in Opencart 2.x.
open system/library/cart.php. You will find follwoing function.
public function add
You can run delete query at very fast in this function.