Skip to content

Commit b912aae

Browse files
committed
Use OrderFactory.deletedShippingLine to remove shipping line
1 parent 9edbb95 commit b912aae

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Creation/Synchronizer/ShippingInputTransformer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct ShippingInputTransformer {
1111
// If input is `nil`, then we remove any existing shipping line.
1212
// We remove a shipping like by setting its `methodID` to nil.
1313
guard let input = input else {
14-
let linesToRemove = order.shippingLines.map { $0.copy(methodID: .some(nil), total: "0") }
14+
let linesToRemove = order.shippingLines.map { OrderFactory.deletedShippingLine($0) }
1515
return order.copy(shippingTotal: "0", shippingLines: linesToRemove)
1616
}
1717

Yosemite/Yosemite/Stores/Order/OrderFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public enum OrderFactory {
7474
/// Creates a shipping line suitable to delete a shipping line already saved remotely in an order.
7575
///
7676
public static func deletedShippingLine(_ shippingLine: ShippingLine) -> ShippingLine {
77-
shippingLine.copy(methodID: .some(nil))
77+
shippingLine.copy(methodID: .some(nil), total: "0")
7878
}
7979

8080
/// References a new empty order with constants `Date` values.

0 commit comments

Comments
 (0)