src/Cart/ShoppingCart.php
public function clear($write = true)
    {
        $session = ShopTools::getSession();
        $session->set(self::config()->cartid_session_name, null)->clear(self::config()->cartid_session_name);
        $order = $this->current();
        $this->order = null;

        if ($write) {
            if (!$order) {
                return $this->error(_t(__CLASS__ . '.NoCartFound', 'No cart found.'));
            }
            $order->write();
        }
        $this->message(_t(__CLASS__ . '.Cleared', 'Cart was successfully cleared.'));

        return true;
    }
public function clear($write = true)
    {
        $session = ShopTools::getSession();
        $session->set(self::config()->cartid_session_name, null)->clear(self::config()->cartid_session_name);
        $order = $this->current();
        $this->order = null;

        if ($write) {
            if (!$order) {
                return $this->error(_t(__CLASS__ . '.NoCartFound', 'No cart found.'));
            }
            $order->write();
        }
        $this->message(_t(__CLASS__ . '.Cleared', 'Cart was successfully cleared.'));

        return true;
    }
Empty / abandon the entire cart.

@param  bool $write whether or not to write the abandoned order
@return bool - true if successful, false if no cart found