cancel
Showing results for 
Search instead for 
Did you mean: 

Get the Mini cart content outside Magento2 using Ajax

Get the Mini cart content outside Magento2 using Ajax

Hi,

I am working on Magento 2.2.3. I am trying to get the content of the minicart using Ajax since calling from outside Magento. I can't able to retrieve the minicart due to the knockout js. I am trying in the following way. 

 

$blockHtml = $resultPage->getLayout()
->createBlock('\Magento\Checkout\Block\Cart\Sidebar')
->setTemplate('Magento_Checkout::cart/minicart.phtml')
->toHtml();

how to load the data to knockout js templates? is there any other better way to do it?

 

Thanks in advance