-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fixed #18823: Prefix dropdown in checkout doesn't select empty value by defau… #26640
Conversation
Hi @mikebox. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
Related to #20896 |
As per discussion with PO @mbrinton01, the expected behavior is: #17861 was configuration issue but not the functional. |
@@ -98,6 +98,11 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false) | |||
return false; | |||
} | |||
$result = []; | |||
|
|||
if (substr($options, 0, 1) === ";") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this check.
if (substr($options, 0, 1) === ";") { | ||
$result = array_merge([' ' => ' '], $result); | ||
} | ||
|
||
$options = array_filter(explode(';', $options)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$options = array_filter(explode(';', $options)); | |
$options = explode(';', $options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikebox please see my comments and consider covering these cases with MFTF tests. Thank you.
Hi @mikebox @lenaorobei |
I like this idea! Let me confirm with @mbrinton01 since it will be a pretty big UI change and I believe we should take care of |
I'm fine with this approach as it should return the same experience for the user. |
I will take care of test coverage. |
b81da50
to
b3497f5
Compare
Hi @lenaorobei, thank you for the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mikebox.
During testing, we faced the issue.
Problem: Prefix dropdown in checkout doesn't select an empty value by default
Manual testing scenario:
- In Admin Backend go to Stores > Configuration > Customers > Name and Address Options;
- Set "Show Prefix" to "Required";
- Set "Prefix Dropdown Options" to ";Mr.;Mrs.";
- Save Config and go to your store;
- Add an item to your cart and go to checkout;
Actual Result: The value "Mr." is selected by default
@mikebox Could you take a look?
Thanks!
Pull Request state was updated. Re-review required.
Closing this PR due to inactivity. Please feel free to reopen if you are going to continue working on it. |
Hi @mikebox, thank you for your contribution! |
Fixed #18823: Prefix dropdown in checkout doesn't select empty value by default if required
Description (*)
Added a condition to ensure the options provided by the customers start with the separator(;). If the separator exists at the start of the options, adding an empty option in the select.
Additional Notes:
array_filter() removes the empty characters. Removing that might create additional problems of having empty options in the middle. So added a condition to ensure the starting character and act based on that.
Fixed Issues (if relevant)
Manual testing scenarios (*)
Contribution checklist (*)