Magento2: Not able to checkout - Javascript error occurred.

Created on 14 Aug 2016  路  8Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.1 with luma theme
  2. PHP 5.6 , Nginx, PHP-Fpm

Steps to reproduce

  1. Create a new account.
  2. Place an order. ( Default country US & Shipping country during place order - India. Leave the state as empty since its optional)
  3. Try place an order again

(if not reproduced)

  1. Login to admin and select the customer.
  2. Uncheck default shipping address.
  3. Login as a customer and check billing and shipping address is not there under manage address section.
  4. Add a product to cart and try to checkout .

Expected result

  1. Checkout page should load with shipping fields and the shipping method.

Actual result

  1. Left side section is empty and there is a javascript error as well.
    checkout-page-error
Checkout Cannot Reproduce Clear Description Format is valid bug report

Most helpful comment

I was facing the same issue, and limiting the customer to using only 1 line for the street address was not a valid solution.
Looks like a fix was added to the develop branch (not included in 2.1.1). But as an alternative, I fixed it by overriding module-checkout/web/js/view/shipping.js and changing the following (L115):

    checkoutProvider.set(
        'shippingAddress',
        $.extend({}, checkoutProvider.get('shippingAddress'), shippingAddressData)
    );

to this:

    checkoutProvider.set(
        'shippingAddress',
        $.extend(true, checkoutProvider.get('shippingAddress'), shippingAddressData)
    );

This will make the element merging recursive into the street object and prevent the previous shipping address from destroying the additional address line placeholder elements. So when it gets to validating those fields, they still exist in the resulting shipping address as empty strings.

All 8 comments

I'm also having the same issue. Would be good to find out when the fix will likely be shipped.

Same issue here!

could not reproduce. I see from the screenshot error occurs in rules.js
you might have cart rule setup. Please share this information

It seems to be a duplicate of :
https://github.com/magento/magento2/issues/4921

I was facing the same issue, and limiting the customer to using only 1 line for the street address was not a valid solution.
Looks like a fix was added to the develop branch (not included in 2.1.1). But as an alternative, I fixed it by overriding module-checkout/web/js/view/shipping.js and changing the following (L115):

    checkoutProvider.set(
        'shippingAddress',
        $.extend({}, checkoutProvider.get('shippingAddress'), shippingAddressData)
    );

to this:

    checkoutProvider.set(
        'shippingAddress',
        $.extend(true, checkoutProvider.get('shippingAddress'), shippingAddressData)
    );

This will make the element merging recursive into the street object and prevent the previous shipping address from destroying the additional address line placeholder elements. So when it gets to validating those fields, they still exist in the resulting shipping address as empty strings.

@victor-v-rad I didn't configure any rule. But I do installed the sample data. Hopefully you can replicate with that. And you can also check @moloughlin comment above.

as @moloughlin said, the issue is around address.line.1, the value is undefined, and the rules engine is failing due to that

@senthilengg, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.1.9

Was this page helpful?
0 / 5 - 0 ratings