carolineschnapp / shipping-calculator

To use in Shopify to add a shipping rates calculator to the cart page. Requires jQuery.
http://wiki.shopify.com/Adding_a_Shipping_Rates_Calculator_to_your_Cart_Page
61 stars 42 forks source link

Shipping Calculator vs Simple Theme #19

Open Daaaaad opened 7 years ago

Daaaaad commented 7 years ago

Hello,

I followed carefully the https://help.shopify.com/themes/customization/cart/add-shipping-calculator tutorial but I'm stuck with the same error message in the console :

Uncaught TypeError: Cannot read property '1' of null
    at _formatRate (theme.js?4269964971980373709:11)
    at _onCartShippingRatesUpdate (theme.js?4269964971980373709:11)
    at Object.success (theme.js?4269964971980373709:11)
    at j (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at x (jquery.min.js:4)
    at XMLHttpRequest.b (jquery.min.js:4)

That corresponds to the switch condition here (coming from the gist in the tutorial) :

var n = "",
                a = /\{\{\s*(\w+)\s*\}\}/,
                i = _config.moneyFormat;
            switch (i.match(a)[1]) {
                case "amount":
                    n = r(e, 2);
                    break;
                case "amount_no_decimals":
                    n = r(e, 0);
                    break;
                case "amount_with_comma_separator":
                    n = r(e, 2, ".", ",");
                    break;
                case "amount_no_decimals_with_comma_separator":
                    n = r(e, 0, ".", ",")
            }

My currency is EUR (€) and my store is configured to use "Weight based rates".

Can you help ?

Regards,

David.