Skip to content

Full page cache problem in magento 2 #13219

Closed
@BabliDey

Description

@BabliDey

#6624
#6392

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Format is not validGate 1 Failed. Automatic verification of issue format is failed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions