I want summary count in .phtml file with cache enable.
Asked
Active
Viewed 571 times
6
-
1where u want to get summery count, means product page or category page etc...? – Biren Patel Jan 01 '20 at 13:35
-
I want summary count in footer same like header. – M2 Dev Jan 01 '20 at 13:38
1 Answers
9
You should get it with customer data. You can try to add the following code in your phtml file.
<script type="text/javascript">
require([
'Magento_Customer/js/customer-data'
], function (customerData) {
'use strict';
customerData.get('cart').subscribe(function (cartInfo) {
console.log(cartInfo['summary_count']);
}, this);
});
</script>
Biren Patel
- 940
- 7
- 28