public function saveCart(CartInterface $cart)
    {
        if (!$cart->getCartLines()->isEmpty()) {
            $this->cartObjectManager->persist($cart);
        }

        $this
            ->cartObjectManager
            ->flush();
    }
public function saveCart(CartInterface $cart)
    {
        if (!$cart->getCartLines()->isEmpty()) {
            $this->cartObjectManager->persist($cart);
        }

        $this
            ->cartObjectManager
            ->flush();
    }
public function saveCart ( CartInterface $ cart ) { if ( ! $ cart -> getCartLines ( ) -> isEmpty ( ) ) { $ this -> cartObjectManager -> persist ( $ cart ) ; } $ this -> cartObjectManager -> flush ( ) ; }
Flushes all loaded cart and related entities.

We only persist it if have lines loaded inside, so empty carts will never
be persisted

@param CartInterface $cart Cart
Flushes all loaded cart and related entities .