Skip to content

Commit 1af647c

Browse files
committed
Render payment section based on the local organizer
1 parent d81ef4d commit 1af647c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ final class NewOrderViewModel: ObservableObject {
124124
/// Indicates if the Payment section should be shown
125125
///
126126
var shouldShowPaymentSection: Bool {
127-
orderDetails.items.isNotEmpty
127+
orderSynchronizer.order.items.isNotEmpty
128128
}
129129

130130
/// Defines if the view should be disabled.
@@ -488,14 +488,14 @@ private extension NewOrderViewModel {
488488
/// Updates payment section view model based on items in the order.
489489
///
490490
func configurePaymentDataViewModel() {
491-
$orderDetails
492-
.map { [weak self] orderDetails in
491+
orderSynchronizer.orderPublisher
492+
.map { [weak self] order in
493493
guard let self = self else {
494494
return PaymentDataViewModel()
495495
}
496496

497-
let itemsTotal = orderDetails.items
498-
.map { $0.orderItem.subtotal }
497+
let itemsTotal = order.items
498+
.map { $0.subtotal }
499499
.compactMap { self.currencyFormatter.convertToDecimal(from: $0) }
500500
.reduce(NSDecimalNumber(value: 0), { $0.adding($1) })
501501
.stringValue
@@ -520,7 +520,7 @@ private extension NewOrderViewModel {
520520

521521
/// Tracks when the create order button is tapped.
522522
///
523-
/// Warning: This methods assume that `orderDetails.items.count` is equal to the product count,
523+
/// Warning: This methods assume that `orderSynchronizer.order.items.count` is equal to the product count,
524524
/// As the module evolves to handle more types of items, we need to update the property to something like `itemsCount`
525525
/// or figure out a better way to get the product count.
526526
///

0 commit comments

Comments
 (0)