Util.js from bootstrap4 js not working (Cannot read property 'fn' of undefined)

Hey guys,

I am using sage 8.5.3 since sage 9 doesn’t work for me. What I simply want to do is to install bootstrap4 css with bootstrap4 js. In lib/setup.php I put both of them :

wp_enqueue_script(‘bootstrap4/popper’, ‘https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js’, [‘jquery’], null, true);

wp_enqueue_script(‘bootstrap4/js’, ‘https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js’, [‘jquery’], null, true);

But my issue is that I get this error in the console : Cannot read property ‘fn’ of undefined (util.js:85)

Is there anything I could do to fix this issue? Thanks

1 Like

Hi @Mcutewood - I believe that’s a bug from Bootstrap 4 beta 2 that was fixed in beta 3. Try using the final v4 release that just came out instead and see if that works for you.

And here’s an alternative way to use Bootstrap 4 in Sage 8 if you’re interested: Sage 8 legacy sites and Bootstrap 4 stable version. I think the main advantage over enqueuing the files directly would be if you either a) wanted it bundled with your other CSS/JS files or b) wanted to customize it for your site with SASS or including/excluding certain files.

If you are using our compiled JavaScript, be sure to include the versions of jQuery and Popper.js before it.