Closed jaclync closed 1 week ago
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
App Name | WooCommerce iOS | |
Build Number | pr12654-036c381 | |
Version | 18.5 | |
Bundle ID | com.automattic.alpha.woocommerce | |
Commit | 036c381f435a3148a39a1a99f44bfae93439d9c8 | |
App Center Build | WooCommerce - Prototype Builds #8960 |
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.
Closes: #12652
Why
Another way to add/edit a customer in order form other than entering the email/addresses manually is to select an existing customer. This is already supported in the app, and this PR creates a CTA based on the design and integrates with the existing customer search flow.
How
The CTA is located above the customer card, at the trailing edge of the customer section header text in
OrderCustomerSection
. When the search icon is tapped, it opens a sheet of the customer selector under theviewModel.showsCustomerSearch
boolean. The customer selector requires aaddressFormViewModel: CreateOrderAddressFormViewModel
parameter, even though it isn't used in the selector internally because we disallow editing customer details bydisallowCreatingCustomer: true
.While testing, I encountered a bug where selecting a customer from the selector sheet (where
dismiss
is called in the view controller) would close both the sheet and the order form. It turned out that because I originally reinitialized theOrderCustomerSectionViewModel
inconfigureCustomerDataViewModel
whenever the order changes, the section view model'sshowsCustomerSearch
boolean also got reset tofalse
(default value), and thus the sheet is hidden automatically and order form got dismissed instead. To fix this issue, I updatedOrderCustomerSectionViewModel
to have the same lifetime asEditableOrderViewModel
/ order form and synced the customer data via a published variable.Testing instructions
Prerequisite: the store has at least two different customers
Create order
Add Customer
--> there should be new space above the customer card with a search icon at the trailing edgeCreate
--> the customer details should be saved to the new order remotelyEdit order
Edit
--> a customer card should be shownScreenshots
https://github.com/woocommerce/woocommerce-ios/assets/1945542/3b777ec4-d9ac-4d4f-a54b-6abc5d087122
RELEASE-NOTES.txt
if necessary.