Skip to content

Commit b473bf0

Browse files
committed
Send inputs to OrderSynchronizer when a new product is added
1 parent 59e1e11 commit b473bf0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Creation/NewOrderViewModel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ private extension NewOrderViewModel {
436436
/// Adds a selected product (from the product list) to the order.
437437
///
438438
func addProductToOrder(_ product: Product) {
439-
let newOrderItem = NewOrderItem(product: product, quantity: 1)
440-
orderDetails.items.append(newOrderItem)
439+
let input = OrderSyncProductInput(product: .product(product), quantity: 1)
440+
orderSynchronizer.setProduct.send(input)
441441
configureProductRowViewModels()
442442

443443
analytics.track(event: WooAnalyticsEvent.Orders.orderProductAdd(flow: .creation))
@@ -446,8 +446,8 @@ private extension NewOrderViewModel {
446446
/// Adds a selected product variation (from the product list) to the order.
447447
///
448448
func addProductVariationToOrder(_ variation: ProductVariation) {
449-
let newOrderItem = NewOrderItem(variation: variation, quantity: 1)
450-
orderDetails.items.append(newOrderItem)
449+
let input = OrderSyncProductInput(product: .variation(variation), quantity: 1)
450+
orderSynchronizer.setProduct.send(input)
451451
configureProductRowViewModels()
452452

453453
analytics.track(event: WooAnalyticsEvent.Orders.orderProductAdd(flow: .creation))

0 commit comments

Comments
 (0)