carolineschnapp / shipping-calculator

To use in Shopify to add a shipping rates calculator to the cart page. Requires jQuery.

Home Page:http://wiki.shopify.com/Adding_a_Shipping_Rates_Calculator_to_your_Cart_Page

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shipping Calculator vs Simple Theme

Daaaaad opened this issue · comments

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.