Skip to content

Commit 085943d

Browse files
committed
Add feature flag check for shipping row
1 parent cc4d1c1 commit 085943d

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Creation/PaymentSection/OrderPaymentSection.swift

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,8 @@ struct OrderPaymentSection: View {
2424

2525
TitleAndValueRow(title: Localization.productsTotal, value: .content(viewModel.itemsTotal), selectionStyle: .none) {}
2626

27-
if viewModel.shouldShowShippingTotal {
28-
TitleAndValueRow(title: Localization.shippingTotal, value: .content(viewModel.shippingTotal), selectionStyle: .highlight) {
29-
saveShippingLineClosure(nil)
30-
}
31-
} else {
32-
Button(Localization.addShipping) {
33-
let testShippingLine = ShippingLine(shippingID: 0,
34-
methodTitle: "Flat Rate",
35-
methodID: "other",
36-
total: "10",
37-
totalTax: "",
38-
taxes: [])
39-
saveShippingLineClosure(testShippingLine)
40-
}
41-
.buttonStyle(PlusButtonStyle())
42-
.padding()
27+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.orderCreation) {
28+
shippingRow
4329
}
4430

4531
TitleAndValueRow(title: Localization.orderTotal, value: .content(viewModel.orderTotal), bold: true, selectionStyle: .none) {}
@@ -53,6 +39,26 @@ struct OrderPaymentSection: View {
5339

5440
Divider()
5541
}
42+
43+
@ViewBuilder private var shippingRow: some View {
44+
if viewModel.shouldShowShippingTotal {
45+
TitleAndValueRow(title: Localization.shippingTotal, value: .content(viewModel.shippingTotal), selectionStyle: .highlight) {
46+
saveShippingLineClosure(nil)
47+
}
48+
} else {
49+
Button(Localization.addShipping) {
50+
let testShippingLine = ShippingLine(shippingID: 0,
51+
methodTitle: "Flat Rate",
52+
methodID: "other",
53+
total: "10",
54+
totalTax: "",
55+
taxes: [])
56+
saveShippingLineClosure(testShippingLine)
57+
}
58+
.buttonStyle(PlusButtonStyle())
59+
.padding()
60+
}
61+
}
5662
}
5763

5864
// MARK: Constants

0 commit comments

Comments
 (0)