File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
WooCommerce/Classes/ViewRelated/Orders/Order Creation/ProductsSection Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ struct AddProductToOrder: View {
5757 @ViewBuilder private func createProductRow( rowViewModel: ProductRowViewModel ) -> some View {
5858 if rowViewModel. numberOfVariations > 0 {
5959 NavigationLink {
60- // TODO: Navigate to variation list
60+ if let addVariationToOrderVM = viewModel. getVariationsViewModel ( for: rowViewModel. productOrVariationID) {
61+ AddProductVariationToOrder ( isPresented: $isPresented, viewModel: addVariationToOrderVM)
62+ }
6163 } label: {
6264 ProductRow ( viewModel: rowViewModel)
6365 }
Original file line number Diff line number Diff line change @@ -82,6 +82,15 @@ final class AddProductToOrderViewModel: ObservableObject {
8282 }
8383 onProductSelected ? ( selectedProduct)
8484 }
85+
86+ /// Get the view model for a list of product variations to add to the order
87+ ///
88+ func getVariationsViewModel( for productID: Int64 ) -> AddProductVariationToOrderViewModel ? {
89+ guard let variableProduct = products. first ( where: { $0. productID == productID } ) else {
90+ return nil
91+ }
92+ return AddProductVariationToOrderViewModel ( siteID: siteID, product: variableProduct)
93+ }
8594}
8695
8796// MARK: - SyncingCoordinatorDelegate & Sync Methods
You can’t perform that action at this time.
0 commit comments