Shipping Labels: Validate that address name field is not empty #4601
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #4480
Description
When you start to create a shipping label, we auto-fill the origin address name field with the first and last name from the user's account settings. If the account settings are not in storage, or don't include a first/last name, the name is left blank. This causes problems later on, because the name is required (e.g. to load carriers and rates for the package).
This PR adds local validation to check that the name field is not empty. If it is empty, it opens the Edit Address screen to prompt the user to enter a name. (We already have validation on the Edit Address screen to ensure the name field is filled out there.)
Note that we have related issues for remote name validation (https://github.com/Automattic/woocommerce-services/issues/2457) and making sure account settings are synced in storage after login (#4600), which aren't part of this PR.
Changes
address.name.isEmpty
before doing the remote address validation inShippingLabelFormViewModel
.Testing
First name
andLast name
are empty in your WordPress.com account settings.Ship from
section, tap the "Continue" button.Submitter Checklist
Update release notes:
RELEASE-NOTES.txt
if necessary.