private function getCustomerCart(CustomerInterface $customer)
    {
        $customerCart = $customer
            ->getCarts()
            ->filter(function (CartInterface $cart) {
                return !$cart->isOrdered();
            })
            ->first();

        if ($customerCart instanceof CartInterface) {
            return $customerCart;
        }

        return null;
    }
private function getCustomerCart(CustomerInterface $customer)
    {
        $customerCart = $customer
            ->getCarts()
            ->filter(function (CartInterface $cart) {
                return !$cart->isOrdered();
            })
            ->first();

        if ($customerCart instanceof CartInterface) {
            return $customerCart;
        }

        return null;
    }
private function getCustomerCart ( CustomerInterface $ customer ) { $ customerCart = $ customer -> getCarts ( ) -> filter ( function ( CartInterface $ cart ) { return ! $ cart -> isOrdered ( ) ; } ) -> first ( ) ; if ( $ customerCart instanceof CartInterface ) { return $ customerCart ; } return null ; }
Return customer related cart.

If customer has any cart related, creates new and returns it
Otherwise, retrieves it and saves it to session

@param CustomerInterface $customer

@return CartInterface Cart
Return customer related cart .