Skip to content

Commit 0f31c1d

Browse files
committed
Remove redundant OrderItemModel
1 parent 088c7e7 commit 0f31c1d

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

WooCommerce/Classes/ViewModels/Order Details/Shipping Labels/AggregatedShippingLabelOrderItems.swift

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -145,30 +145,6 @@ private extension AggregatedShippingLabelOrderItems {
145145
attributes: orderItem?.attributes ?? [],
146146
addOns: orderItem?.addOns ?? [],
147147
parent: orderItem?.parent)
148-
case .product(let product, let orderItem, let name):
149-
let itemID = orderItem?.itemID.description ?? "0"
150-
let productName = orderItem?.name ?? name
151-
let price = orderItem?.price ??
152-
currencyFormatter.convertToDecimal(product.price) ?? 0
153-
let totalPrice = price.multiplying(by: .init(decimal: Decimal(quantity)))
154-
let imageURL: URL?
155-
if let encodedImageURLString = product.images.first?.src.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
156-
imageURL = URL(string: encodedImageURLString)
157-
} else {
158-
imageURL = nil
159-
}
160-
return .init(itemID: itemID,
161-
productID: product.productID,
162-
variationID: 0,
163-
name: productName,
164-
price: price,
165-
quantity: Decimal(quantity),
166-
sku: orderItem?.sku ?? product.sku,
167-
total: totalPrice,
168-
imageURL: imageURL,
169-
attributes: orderItem?.attributes ?? [],
170-
addOns: orderItem?.addOns ?? [],
171-
parent: orderItem?.parent)
172148
case .productVariation(let variation, let orderItem, let name):
173149
let itemID = orderItem?.itemID.description ?? "0"
174150
let productName = orderItem?.name ?? name
@@ -215,7 +191,6 @@ private extension AggregatedShippingLabelOrderItems {
215191
/// The underlying model for an order item.
216192
enum OrderItemModel {
217193
case productName(name: String)
218-
case product(product: Product, orderItem: OrderItem?, name: String)
219194
case productVariation(productVariation: ProductVariation, orderItem: OrderItem?, name: String)
220195
case productListItem(item: ProductListItem, orderItem: OrderItem?, name: String)
221196
}

0 commit comments

Comments
 (0)