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

Shipping Labels: Required name field in origin address is empty but still validates until app is relaunched after login #4480

Closed
rachelmcr opened this issue Jun 25, 2021 · 2 comments · Fixed by #4601
Assignees
Labels
feature: shipping labels Related to creating, ordering, or printing shipping labels. type: bug A confirmed bug.

Comments

@rachelmcr
Copy link
Contributor

rachelmcr commented Jun 25, 2021

Describe the bug

After logging in to the app, if the app hasn't been relaunched and the user creates a shipping label:

  1. The "Name" field in the origin address is not auto-filled.
  2. The origin address is still validated even though the Name field is required.
  3. The only way to know something is wrong is by tapping on the origin address to see the "Name missing" error there.
  4. You can get all the way to the "Carrier and Rates" section before running into a problem (no rates are loaded), and it isn't clear what caused it unless you know to check the origin address.

Error from the API:

{
  "error" : "wcc_server_error_response",
  "message" : "Error: The WooCommerce Shipping & Tax server returned: Bad Request child \"origin\" fails because [child \"name\" fails because [\"name\" is not allowed to be empty]] ( 400 )"
}

To Reproduce
Steps to reproduce the behavior:

  1. Make sure WooCommerce Shipping & Tax is set up on your store, with packages added in the settings.
  2. Log in to the app.
  3. Open an order detail that is eligible for the shipping label.
  4. Tap the button "Create Shipping Label".
  5. Tap "Continue" on the Ship From field and notice it is validated.
  6. Continue until you get to the Shipping Carrier and Rates field, and notice you get an error there.
  7. Go back and tap on the "Ship From" field and notice the "Name missing" error. Enter a name and notice you can now view and select a carrier and rates.

Note that if you force close and relaunch the app at any point, when you create a shipping label the name field is now filled in.

Screenshots

Creating a shipping label (no name) Validating the origin address Origin address validated Name missing
Simulator Screen Shot - iPhone 11 Pro - 2021-06-25 at 13 27 06 Simulator Screen Shot - iPhone 11 Pro - 2021-06-25 at 13 27 11 Simulator Screen Shot - iPhone 11 Pro - 2021-06-25 at 13 27 15 Simulator Screen Shot - iPhone 11 Pro - 2021-06-25 at 13 27 18
@rachelmcr rachelmcr added type: bug A confirmed bug. feature: shipping labels Related to creating, ordering, or printing shipping labels. labels Jun 25, 2021
@rachelmcr rachelmcr added this to To do in Shipping Labels Milestone 3 via automation Jun 25, 2021
@rachelmcr rachelmcr self-assigned this Jul 12, 2021
@rachelmcr rachelmcr moved this from To do to In progress in Shipping Labels Milestone 3 Jul 12, 2021
@rachelmcr rachelmcr changed the title Shipping Labels: Required name field in origin address is empty for non-store-owner but still validates Shipping Labels: Required name field in origin address is empty but still validates until app is relaunched after login Jul 12, 2021
@rachelmcr
Copy link
Contributor Author

I did a little investigation and made a couple relevant discoveries:

  • This issue is actually related to creating a shipping label just after logging in to the app, not for specific user types. (I updated the issue title and description to reflect that.)
  • The remote endpoint ignores the name when it validates the address, so we'll have to handle this locally.

This could use a couple fixes:

  1. Don't allow the user to continue if the name field is empty. We could build this into ShippingLabelAction.validateAddress or just check it within ShippingLabelFormViewModel.validateAddress.
  2. Make sure the name field is filled out when possible, even if the app hasn't been relaunched. I'm guessing from a quick look that this issue can happen because there aren't any stored account settings when we call ShippingLabelFormViewModel.getStoredAccountSettings() the first time after login.

@pmusolino
Copy link
Member

Thank you @rachelmcr for investigating this.

I think that we can handle this locally, but at the same time, we should inform the backend team about this issue because they should handle this validation also on their side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: shipping labels Related to creating, ordering, or printing shipping labels. type: bug A confirmed bug.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants