-
Notifications
You must be signed in to change notification settings - Fork 47
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
Setting number of address line lower than existing entry breaks all checkouts for existing address data #116
Comments
which then ends up here: which is exactly the issue. Checkout assumes / expects data to conform to the max lines, and just splits it. So, the fix will be to not assume the max characters, but actually produce the result here, base don max characters, and IMO any 'spill over' rows be concatenated to the last line. So, if we have set 1 row, then they will all conact to 1 row, and if we set back to 3 rows, data will be able to transform. |
ok, won't let me upload as attachement This is for 1.0.x / magento 2.4.7
|
Here is a magento 2.4.4-p11 patch.
|
Damn, i was working on the tests, and then found this hidden in the helper
so, rather than having my own code adjusted like I did, I am refactoring to use this, so as to conform to anywhere else doing this. |
yes, using the core helper method works just as well, they simply did it the other way round, concatenating into teh first line, not the last, as I did. This introduces less new core code, so will be how I will do the MR |
Preconditions and environment
Description:
If admin setting is changed to set number of allowed address lines lower than what is current config value, and data exists against current config value, checkout breaks complete. User is not allowed to checkout, and reason can be obscured, especially with 3rd party payment methods.
Steps to reproduce
./bin/magento con:set customer/address/street_lines 4
Expected result: Checkout is a success.
./bin/magento con:set customer/address/street_lines 3
address clearly still has 4 lines of data, and displays as such.
expected result: able to checkout
what actually happens:
Old address data (4 lines) block ability to checkout
NOTE:
This was using base cash on delivery payment method, but, if you for example use braintree / paypal, the error message is completely obscured.
The issue with braintree/paypal, is that the exception triggers a fail, which then tries to revert the order, but, since no order was actually place, a new exception occurs, overriding the address line one, and the user is not cleanly (if at all) told why they can't buy.
In both paypal/braintree usage, the error is simply a rest exception:
and the user is just stuck on a checkout page with a payment button that does not work.
I have noticed that the exception can be trapped by couponUsage plugin
which then for some reason ends up under orderCancelation, trying to rollback maybe?
This then fails with the fact there is no $incrementID, which raises a new exception, and obscures the real reason from client/frontend.
This can result in a lot of sales lost.
additionally:
Check address in my account
They display as before (is this fine ?) - showing 4 lines (does not break anything here)
Edit address:
The 4th address line is now dropped (but there is still data in db for it, as can be seen in previous display)
expected: Maybe the last lines should now be combined? (comma separated?)
Conclusion / expected / discussion
The address data is store in magento as a single one line field, no matter the number of address lines configured.
The 'lines' are separated by a 'newline' char.
IMO, the system should retain ability to go between address line numbers, and the change should definitely not affect checkout.
The code that results in the address lines, should populate the needed data accordingly.
If there are more delimiters ion the address line field, than the configured address lines, the last line should simply contain a concat of the remainder field values, with the newline stripped.
if you look at the data where the address is validated during checkout, it can clearly be seen that the resulting data is just splitting at newlines, and ignoring the configure address line limits.
line 156 on : vendor/mage-os/module-quote/Model/CustomerManagement.php
This should only be done for existing data, or maybe just during checkout.
Other outcomes/solution suggestions?
Expected result
I can checkout irrespective if my address data was more lines that last time I checked out :)
Actual result
User is stuck / cannot checkout / reason is not clear.
Additional information
No response
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: