public function getCartContentIds()

in Helper/MagentoDataHelper.php [185:198]


    public function getCartContentIds()
    {
        $productIds = [];
        $cart = $this->objectManager->get(\Magento\Checkout\Model\Cart::class);
        if (!$cart || !$cart->getQuote()) {
            return null;
        }
        $items = $cart->getQuote()->getAllVisibleItems();
        foreach ($items as $item) {
            $product = $item->getProduct();
            $productIds[] = $product->getId();
        }
        return $productIds;
    }