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] Update local requirements for address fields #14865

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Jan 14, 2025

Part of: #13781

Description

This updates some of the local requirements for address fields in the Woo Shipping label flow. Instead of a fixed set of required fields, this moves the checks for whether a field is required into the view model. This will allow us to update the requirements based on data in the view model.

Changes in this PR:

  • Moves the checks for whether a field is required into the view model.
  • Adds the phoneNumberRequired property. The phone number is always required for origin addresses but not always required for destination addresses, so this is a step toward making the view and view model useful for both address types.
  • Updates the check for name and company fields, so that only one is required. (If one field is non-empty, the other becomes optional.)

Future PRs will continue to update the local requirements, add validation, and prepare the view model for reuse for destination addresses.

Testing information

  1. Ensure the Woo Shipping extension is installed, activated, and set up on your store.
  2. Create or open an order with at least one physical product and the processing status.
  3. Tap "Create Shipping Label" in order details.
  4. Open the "Shipment details" bottom sheet.
  5. Tap the "Ship from" origin address.
  6. Tap the edit (pencil) icon on one of the origin addresses.
  7. In the address form, confirm you see a * to indicate the phone number field is required.
  8. Clear the company field and confirm the name field is marked as required, while the company field is optional.
  9. Clear the name field and confirm the company field is marked as required, while the name field is optional.
  10. Confirm all other fields are still marked as required.

Note: If both the name and company field are empty, they are both marked as required until one is entered. If both the name and company field are populated, they are both marked as optional until one is cleared.

Screenshots

Name required Company required Phone required
Simulator Screenshot - iPhone 16 Pro - 2025-01-14 at 17 00 53 Simulator Screenshot - iPhone 16 Pro - 2025-01-14 at 17 03 10 Simulator Screenshot - iPhone 16 Pro - 2025-01-14 at 17 00 57

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@rachelmcr rachelmcr added the feature: shipping labels Related to creating, ordering, or printing shipping labels. label Jan 14, 2025
@rachelmcr rachelmcr added this to the 21.5 milestone Jan 14, 2025
@wpmobilebot
Copy link
Collaborator

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14865-32c8a1d
Version21.4
Bundle IDcom.automattic.alpha.woocommerce
Commit32c8a1d
App Center BuildWooCommerce - Prototype Builds #12527
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Copy link
Contributor

@toupper toupper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀 🚢

@rachelmcr rachelmcr merged commit 40a41f4 into trunk Jan 15, 2025
20 of 22 checks passed
@rachelmcr rachelmcr deleted the issue/13781-basic-local-requirements branch January 15, 2025 09:42
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants