Blue Commerce theme Checkout Problem

Thought I’d try the blue theme to improve the checkout and it’s hanging when I click checkout.

Getting the following in browser console…

Uncaught ReferenceError: CommerceConfig is not defined
at updateMiniCart (main.js:319:25)
at HTMLDocument. (main.js:12:9)

Uncaught ReferenceError: CommerceConfig is not defined
at HTMLFormElement. (main.js:151:34)

…it’s probably something I’ve done wrong!

Does your checkoutcart resource use the checkoutcart template provided by the theme, and have the ctblue.footer chunk there?

This code should be before the end of the body to transfer some variables to the JS:

<script>
    window.CommerceConfig = {
        cart_url: '[[~[[++commerce.cart_resource]]:htmlent]]',
        checkout_url:  '[[~[[++commerce.checkout_resource]]:htmlent]]',
        i18n: {
            shipping: '[[!%commerce.shipping:htmlent]]',
            tax: '[[!%commerce.is_inclusive:htmlent]]'
        }
    }
</script>
<script src="[[++ctblue.assets_url]]js/main.js"></script>
1 Like

No - I didn’t know about that template. Do I have to use it or can I just insert that script?

You can just use that script.

The header chunk also needs the CSS if you also don’t have that one:

<link rel="stylesheet" href="[[++ctblue.assets_url]]css/main.css">

Thank you. I added the css and js to my own header chunk and then just added that script below the snippet call on the cart page. Is that ok? Looking a little bit messy at the moment but I can tdy up.

Yeah that should work :slight_smile:

1 Like