Description
As the two above told issues are closed that's why I am posting this .
I am using magento 2.1.8. I my custom theme app\design\frontend\Sample\theme-frontend-shop\Magento_Catalog\templates\product\view\form.phtml I have done
`
$quoteId = $objectManager->get('Magento\Checkout\Model\Session')->getQuoteId();
$currentItemCount=0;
if(!empty($quoteId)){
$cartItems = $objectManager->get('\Magento\Checkout\Model\Session')->getQuote()->getAllVisibleItems();
$itemsIds = array();
foreach ($cartItems as $cartItem) {
$itemsIds[] = $cartItem->getProduct()->getId();
}
$currentItemCount = count($itemsIds);
}
echo $currentItemCount;
`
and in my app\design\frontend\Sample\theme-frontend-shop\Magento_Catalog\layout\catalog_product_view.xml I have added
<referenceBlock name="product.info.addtocart" class="Magento\Checkout\Block\Cart" before="-" template="Blumeidealnew_shop::product/view/form.phtml" cacheable="false" />
But this is not working properly when full page cache is enabled.
Need help to fix this issue.