Created
January 12, 2021 16:51
-
-
Save andrewdaluz/7d31beabc910bdd115b636cd18282903 to your computer and use it in GitHub Desktop.
Minicart not updating
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When you have multiple path domain like domain.com/storename/, domain.com/storenamexxx/, ... | |
The mangento misunderstand what is the REQUESTs PATH that it needs update mini cart content. | |
A quick fix for it we should remove the ending trailing slash from URL UPDATE MAPPING as below: | |
Create a new rewrite file: app/design/frontend/VENDOR/THEME/Magento_Customer/templates/js/section-config.phtml | |
<?php | |
/** | |
* Copyright © Magento, Inc. All rights reserved. | |
* See COPYING.txt for license details. | |
*/ | |
/** @var \Magento\Customer\Block\SectionConfig $block */ | |
?> | |
<script type="text/x-magento-init"> | |
{ | |
"*": { | |
"Magento_Customer/js/section-config": { | |
"sections": <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getSections()) ?>, | |
"clientSideSections": <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($block->getClientSideSections()) ?>, | |
"baseUrls": <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode(array_unique([ | |
rtrim($block->getUrl(null, ['_secure' => true]), '/') . '/', // FIX to guarantee end trailing slash on baseUrls | |
rtrim($block->getUrl(null, ['_secure' => false]), '/') . '/', // FIX to guarantee end trailing slash on baseUrls | |
])) ?>, | |
"sectionNames": <?= /* @noEscape */ $this->helper(\Magento\Framework\Json\Helper\Data::class) | |
->jsonEncode($block->getData('sectionNamesProvider')->getSectionNames()) ?> | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment