2

I'm trying to add a product from cart page through ajax, I need to require the default JS : 'Magento_Customer/js/customer-data' so that I can update the cart totals. But as soon as I place this code on my page :

<script>
    require([
'jquery',
'Magento_Customer/js/customer-data', 
'Magento_Checkout/js/action/get-totals'],
function($, customerData, getTotals) {
   //MY LOGIC
}
</script>

I'm getting the error :

Cannot read property 'sectionLoadUrl' of undefined

Is there any way to fix this ? I tried to use 'domReady!' but it's not working.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.