Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkout 'hanging' for 2 out of 3 websites running the SAME Magento code #2933

Closed
martijnhovinga opened this issue Jan 8, 2016 · 24 comments
Closed
Assignees
Labels
bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@martijnhovinga
Copy link

I installed Magento 2 with Softaculous successfully. I only added code to .local host in Magento root for running 3 stores based on the same Magento installation (taking the added code out did not make any difference to the issue below).

On 2 of my stores, after adding to cart and clicking "Go to Checkout' the screen only displays the 'logo and the 'order summary' without the 'shipping' step, see https://babyplus.com.my/checkout Same for https://contoursbaby.com.my/checkout

On the third store however it consistently works fine, running the SAME Magento installation: https://babyfair.com.my/checkout

'Checkout with PayPal' works fine on all websites.

I compared the settings in Store/Config and cannot find any significant differences. Even after a new installation, the problem persists.

I had a well-known Magento extension developer have a look at this, however they could not find the solution. According to their professional opinion, this could be a 'bug'.

@ishakhsuvarov ishakhsuvarov self-assigned this Jan 8, 2016
@ishakhsuvarov
Copy link
Contributor

@martijnhovinga Thank you for reporting the issue.
Currently we can not reproduce described issue with clean magento installation.
Please try to install Magento in one of the recommended ways and test the same case without third-party modules to see if the issue persists.

@martijnhovinga
Copy link
Author

@ishakhsuvarov Thanks for your feedback.
My assumption is that is a bug indeed in the STATE OPTIONS settings under default configuration. Initially I ticked Malaysia in 'State is Required for'.
This is similar to #1508

I found this Javascript error on the checkout pages of babyplus.com.my and contoursbaby.com.my:

/pub/static/frontend/Magento/luma/en_US/Magento_Ui/js/form/element/region.js:34
Uncaught TypeError: Cannot read property 'is_region_required' of undefined
does NOT occur on babyfair.com.my

After changing State Options Settings, the problem still persists in the 2 sites.

@srynot4sale
Copy link

Solved for me - fix was to enable the country specified in the "Default Tax Destination -> Default Country" in "Country Options -> Allowed Countries"

@martijnhovinga
Copy link
Author

Thank you very much! This worked for me as well! PROBLEM SOLVED!

@daim2k5 daim2k5 closed this as completed Jan 12, 2016
@astorm
Copy link

astorm commented Jan 12, 2016

@daim2k5 -- Why'd the ticket get closed? It's great these users solved their problem, but it sounds like they had a valid configuration of Magento that ended up creating javascript errors that blocked other page functionality, and was hard to diagnose. Shouldn't the platform fix that?

@srynot4sale
Copy link

Agreed - this is a horrible bug. Needs to be prevented from occuring

@davidalger davidalger reopened this Jan 12, 2016
@davidalger
Copy link
Member

@martijnhovinga Since you seem to have figured out a way to resolve your issue, would you be able to try providing steps to re-create the issue for the Magento team to be able to reproduce and solve the underlying bug? This definitely sounds like a bug; an obscure misconfiguration such as this should not be able to cause JS errors on the front-end like this.

If I read you right, steps may be something like a) setup store; b) set "State is Required for" to something; c) bug (with workaround being to also configure other setting.

@martijnhovinga
Copy link
Author

@davidalger Without doubt, this is a bug. Even worse, it affects the most vital part of the system, i.e. the checkout process and most customers who wish to buy and face this problem get frustrated and decide to leave the website.So I am very thankful that you will look into this for the sake of others using the system.
The problem was caused by a discrepancy between Default Country and Default Tax Destination Calculation.

The settings in default configuration when the problem occurs are as follows:
"Stores > General > Default Country: Malaysia and >Allowed Countries: Malaysia & Singapore"
and
"Stores > Sales > Tax > Default Tax Destination Calculation: United States"
This resulted in a Javascript error:
/pub/static/frontend/Magento/luma/en_US/Magento_Ui/js/form/element/region.js:34
Uncaught TypeError: Cannot read property 'is_region_required' of undefined

By changing only
"Default Tax Destination Calculation to my default Country, i.e. Malaysia, the problem was solved.

I also configured 2 additional websites, however I don't believe that is relevant. The only surprise was that it worked like a charm in one of the 2 additional stores.

If you want to have access to my production system to check and reproduce, I am willing to grant that depending on the timing (I am in Malaysia/Singapore time zone).

My recommendation is that the value of Default Tax Destination Calculation would be synchronized automatically with the value of the Default Country.

Thank you all.

@ishakhsuvarov
Copy link
Contributor

@martijnhovinga @srynot4sale Thank you for finding the correct steps to reproduce the bug.
We have created an internal ticket MAGETWO-47868 to fix the issue.

@ishakhsuvarov ishakhsuvarov added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jan 13, 2016
@ishakhsuvarov
Copy link
Contributor

Closing the ticket, as the fix for this issue had been delivered to the develop branch.
Please feel free to reopen if there are any additional questions.

@martijnhovinga
Copy link
Author

Thank you.

On 2016-01-28 18:36, Ievgen Shakhsuvarov wrote:

Closing the ticket, as the fix for this issue had been delivered to
the develop branch.
Please feel free to reopen if there are any additional questions.

Reply to this email directly or view it on GitHub [1].

Links:

[1] #2933 (comment)

@dimasdwika
Copy link

dimasdwika commented May 10, 2016

I can still replicate this issue with these configuration (on 2.0.5)

"Stores > General > Default Country: Australia"
"Stores > General > Allow Country: Australia"
"Stores > Sales > Tax > Default Tax Destination Calculation: Australia"

When going to checkout, the issue still persist with Cannot read property 'is_region_required' of undefined as per #3142

And by changing "Stores > General > Allow Country: Australia, United States", it will fix the problem. However, this will prevent using Magento to only sell outside United States.

@ignaciomella
Copy link

I have the same problem on 2.0.5.

Country is Chile but steps too recreate problem are the same as detailed by dimasdwika.

@maksek
Copy link
Contributor

maksek commented May 12, 2016

@dimasdwika, @ignaciomella - the fix was delivered to the develop branch, as @ishakhsuvarov mentioned in his comment.
develop != 2.0.x, I will contact product team to validate if it will be delivered into 2.0.x, otherwise fix will be available in 2.1.0

@komsitr
Copy link
Contributor

komsitr commented Jun 5, 2016

@maksek I apply this fix to the version 2.0.7 but the issue still persists 7b1ac83

loadByStore() function still returns all countries in the list instead of Singapore which is the only country in default country / allowed country / and default tax destination country.

@komsitr
Copy link
Contributor

komsitr commented Jun 5, 2016

OK I find the problem. Please consider the fix below.

Cause:
is_region_required key is missing from the country object being retrieved from country.indexedOptions. Referring to "app\directory\Model\ResourceModel\Country\Collection.php" line: 231

if ($this->helperData->isRegionRequired($value)) {
    $option['is_region_required'] = true;
}

This key will be set only this country requires its region. But the script "app\ui\view\base\web\js\form\element\region.js" doesn't check the existence of this key before referring it.

Solution:
Method 1: Add an else condition / cons is page size will increase because the key is added to all country objects

if ($this->helperData->isRegionRequired($value)) {
    $option['is_region_required'] = true;
}
else {
    $option['is_region_required'] = false;
}

Method 2: Check if the key exists in region.js. I am more on this method due to the cons above mentioned.

if (!('is_region_required' in option) || !option['is_region_required']) {
    this.error(false);
    this.validation = _.omit(this.validation, 'required-entry');
}

I believe that this issue occurs in post-code.js too because the key is_zipcode_optional is using the same implementation method.

@webspeaks
Copy link

Exists in 2.0.7. Doesn't get resolved when I set Tax destination country to same as Only allowed country.

@hpatelgit
Copy link

hpatelgit commented Dec 7, 2016

Hello,

Yes @webspeaks i am also facing this issue into Magento latest ver. 2.1.2. It will work for first order but if you try same country and state with reorder it will gives error 'You can't use the payment type you selected to make payments to the billing country.' and in console it will show 'jquery.js:9666 PUT http://test.com/rest/default/V1/carts/mine/selected-payment-method 400 (Bad Request)'

Please help me to resolve this issue.

Thanks

@hpatelgit
Copy link

Still this issue present into magento 2.1.3.

@PrajapatiChirag
Copy link

I can still replicate this issue with these configuration (on 2.0.7)

"Stores > General > Default Country: Australia"
"Stores > General > Allow Country: Australia"
"Stores > Sales > Tax > Default Tax Destination Calculation: Australia"

Solution:
Method 1: Add an else condition / cons is page size will increase because the key is added to all country objects

if ($this->helperData->isRegionRequired($value)) {
    $option['is_region_required'] = true;
}
else {
    $option['is_region_required'] = false;
}

Method 2: Check if the key exists in region.js. I am more on this method due to the cons above mentioned.

if (!('is_region_required' in option) || !option['is_region_required']) {
    this.error(false);
    this.validation = _.omit(this.validation, 'required-entry');
}

@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Nov 14, 2017
@rvinothraj
Copy link

Hi Guys,
Just now(21-02-2018) i faced this issue, i planed to follow @PrajapatiChirag , but after the the simple way is there on Magento configuration.

Steps:

*   Select Singapore in optional country list.
*   Go to -> Admin Panel -> Stores -> Configuration -> General -> General -> Zip/Postal Code is Optional for 
* Uncheck "Use system value"
* Then select your country (My country: Singapore) -> save.
* Finish -> issue solved.

Thanks,
MaaRaa

@0franco
Copy link

0franco commented Jul 6, 2018

Same issue v. 2.2.2 , solved with the config change provided by @srynot4sale, thank you

@peterjaap
Copy link
Contributor

Backward patch for 2.2.6;

diff --git a/view/base/web/js/form/element/region.js b/view/base/web/js/form/element/region.js
index fec69bf..9b7b9a9 100644
--- a/view/base/web/js/form/element/region.js
+++ b/view/base/web/js/form/element/region.js
@@ -40,7 +40,10 @@ define([
                 return;
             }
 
-            defaultPostCodeResolver.setUseDefaultPostCode(!option['is_zipcode_optional']);
+            defaultPostCodeResolver.setUseDefaultPostCode(true);
+            if (option && (!('is_zipcode_optional' in option) || !option['is_zipcode_optional'])) {
+                defaultPostCodeResolver.setUseDefaultPostCode(false);
+            }
 
             if (this.skipValidation) {
                 this.validation['required-entry'] = false;
-- 
2.17.1

@rstylenl
Copy link

I had the same issue when trying to edit a customer. All was fine after editing the files but when i installed a Vanilla version of Magento 2.2.3 and imported the customer to that one, i could just edit the customer without needing to change the code. So that made me look at the database.

The customer grid was not showing Customer group and Website, so i deced to look at the difference in database fields. Came accross some things that where not right in the Live website, so i changed those fields, and when i edited a customer the Customer group and Website showed up again. But it was still not showing up in the grid view, even after running a php bin/magento index:reindex.

Then I came across an one single entry in eav_entity table which didn't look right. it looked like this:
eav_entity

i looked at the vanilla install and there that table was emtpy, so i decided to backup this table and delete this row. After that i changed back the post-code.js and region.js script to it's original state, and now i can edit customers without isues.

If you have any questions please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests