Magento 2.x – Fix error “cannot read property ‘section loadurl’ of undefined in customer-data.js”


The data which code references to sectionLoadUrl is usually set in the following snippet that (should) be on every Magento front-end page:

So, either something in your system removed this snippet, or you’re somehow invoking the functionality in Magento_Customer/js/customer-data before the snippet’s had a chance to run.

A quick fix for that, would be adding the following code on “<Magento_directry>/app/design/frontend/<Vendor>/<theme>/Magento_Theme/layout/default.xml” :

 

Afterwards, remember to clean cache, and try again.