Skip to content
Merged
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [*] Jetpack setup: Native experience for the connection step [https://github.com/woocommerce/woocommerce-ios/pull/15983]
- [*] Payments: Updated the In-Person Payments `Learn More` redirection to display the correct page based on the selected payment provider [https://github.com/woocommerce/woocommerce-ios/pull/15998]
- [*] Add "POS" label in Most recent orders in My store dashboard [https://github.com/woocommerce/woocommerce-ios/pull/16006]
- [*] Order details: Always show shipping labels section if order is eligible for label creation. [https://github.com/woocommerce/woocommerce-ios/pull/16010]

23.0
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ final class OrderDetailsDataSource: NSObject {
return true
}

/// Whether the button to create shipping labels should be visible.
///
var shouldShowShippingLabelCreation: Bool {
if featureFlags.isFeatureFlagEnabled(.revampedShippingLabelCreation) {
return isEligibleForShippingLabelCreation && !isEligibleForPayment && shipments.isEmpty
}
return isEligibleForShippingLabelCreation && shippingLabels.nonRefunded.isEmpty && !isEligibleForPayment
}
Comment on lines -66 to -71
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itsmeichigo should we hide the button also for users using the old plugin? I assumed the new UI and all the changes should be applied only to the new plugin. This change breaks the functionality completely for old plugin users, there is now way to start shipping label creation, as we try to open the new form but it fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this issue! I prefer to unify the UI to make the code easier to maintain, so I removed the workaround for woo shipping check in 4b251a6. This was added when I introduced the new UI and is no longer needed with the changes in this PR.

This PR is ready for another look 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itsmeichigo I think there is still an issue, we show the new UI even when the order has existing shipping labels, and then there is now way to print the labels nor see their details, this happens a short loading where the labels are correctly shown as you can see from the following video:

Simulator.Screen.Recording.-.iPhone.16.-.2025-08-18.at.10.10.48.mp4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For information, this site had Woo Shipping installed before, and I disabled it, in case this is necessary to reproduce the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for missing that issue. I added a fix in 640a385, it should avoid creating shipments for the legacy plugin. I tested with multiple packages and that works as well.


/// Whether the option to re-create shipping labels should be visible.
///
var shouldAllowRecreatingShippingLabels: Bool {
Expand Down Expand Up @@ -456,11 +447,6 @@ private extension OrderDetailsDataSource {
configureShippingLabelDetail(cell: cell)
case let cell as WCShipInstallTableViewCell where row == .installWCShip:
configureInstallWCShip(cell: cell)
case let cell as ImageAndTitleAndTextTableViewCell where row == .shippingLabelCreationInfo(showsSeparator: true),
let cell as ImageAndTitleAndTextTableViewCell where row == .shippingLabelCreationInfo(showsSeparator: false):
if case .shippingLabelCreationInfo(let showsSeparator) = row {
configureShippingLabelCreationInfo(cell: cell, showsSeparator: showsSeparator)
}
case let cell as ImageAndTitleAndTextTableViewCell where row == .shippingLabelPrintingInfo:
configureShippingLabelPrintingInfo(cell: cell)
case let cell as LargeHeightLeftImageTableViewCell where row == .addOrderNote:
Expand Down Expand Up @@ -489,8 +475,6 @@ private extension OrderDetailsDataSource {
configureCustomAmount(cell: cell, at: indexPath)
case let cell as ButtonTableViewCell where row == .collectCardPaymentButton:
configureCollectPaymentButton(cell: cell, at: indexPath)
case let cell as ButtonTableViewCell where row == .shippingLabelCreateButton:
configureCreateShippingLabelButton(cell: cell, at: indexPath)
case let cell as ButtonTableViewCell where row == .markCompleteButton(style: .primary, showsBottomSpacing: true),
let cell as ButtonTableViewCell where row == .markCompleteButton(style: .primary, showsBottomSpacing: false),
let cell as ButtonTableViewCell where row == .markCompleteButton(style: .secondary, showsBottomSpacing: true),
Expand Down Expand Up @@ -721,33 +705,6 @@ private extension OrderDetailsDataSource {
cell.hideSeparator()
}

private func configureCreateShippingLabelButton(cell: ButtonTableViewCell, at indexPath: IndexPath) {
cell.configure(style: .primary,
title: Titles.createShippingLabel,
bottomSpacing: 0) {
self.onCellAction?(.createShippingLabel(shipmentIndex: nil), nil)
}
cell.hideSeparator()
}

private func configureShippingLabelCreationInfo(cell: ImageAndTitleAndTextTableViewCell, showsSeparator: Bool) {
cell.update(with: .imageAndTitleOnly(fontStyle: .footnote),
data: .init(title: Title.shippingLabelCreationInfoAction,
image: .infoOutlineFootnoteImage,
imageTintColor: .systemColor(.secondaryLabel),
numberOfLinesForTitle: 0,
isActionable: false,
showsSeparator: showsSeparator))

cell.selectionStyle = .default

cell.accessibilityTraits = .button
cell.accessibilityLabel = Title.shippingLabelCreationInfoAction
cell.accessibilityHint =
NSLocalizedString("Tap to show information about creating a shipping label",
comment: "VoiceOver accessibility hint for the row that shows information about creating a shipping label")
}

private func configureShippingLabelDetail(cell: WooBasicTableViewCell) {
cell.bodyLabel?.text = isEligibleForWooShipping ? Footer.viewShippingLabel : Footer.showShippingLabelDetails
cell.applyPlainTextStyle()
Expand Down Expand Up @@ -1272,7 +1229,34 @@ extension OrderDetailsDataSource {
siteShippingMethods = resultsControllers.siteShippingMethods
productVariations = resultsControllers.productVariations
shippingLabels = resultsControllers.shippingLabels
shipments = resultsControllers.shipments
shipments = {
let cachedShipments = resultsControllers.shipments
if cachedShipments.isNotEmpty {
return cachedShipments
}

if !isEligibleForShippingLabelCreation || shippingLabels.isNotEmpty {
/// Skips creating shipments if order is not eligible for creating labels
/// If there are labels but not shipments, the labels were created with legacy plugin,
/// so skip creating shipments to display them the old way instead.
return []
}

/// returns a placeholder shipment with all the order items
return [WooShippingShipment(
siteID: order.siteID,
orderID: order.orderID,
index: "0",
items: order.items.map { item in
var subItems: [String] = []
for index in 0..<item.quantity.intValue {
subItems.append("\(item.itemID)-sub-\(index)")
}
return WooShippingShipmentItem(id: item.itemID, subItems: subItems)
},
shippingLabel: nil
)]
}()
shippingLabelOrderItemsAggregator = AggregatedShippingLabelOrderItems(
shippingLabels: shippingLabels,
orderItems: items,
Expand Down Expand Up @@ -1310,18 +1294,9 @@ extension OrderDetailsDataSource {

var rows: [Row] = Array(repeating: .aggregateOrderItem, count: aggregateOrderItemCount)

switch (shouldShowShippingLabelCreation, isProcessingStatus, isRefundedStatus, isEligibleForPayment) {
case (true, false, false, false):
// Order completed and eligible for shipping label creation:
rows.append(.shippingLabelCreateButton)
rows.append(.shippingLabelCreationInfo(showsSeparator: false))
case (true, true, false, false):
// Order processing shippable:
rows.append(.shippingLabelCreateButton)
rows.append(.markCompleteButton(style: .secondary, showsBottomSpacing: false))
rows.append(.shippingLabelCreationInfo(showsSeparator: false))
case (false, true, false, false):
// Order processing digital:
switch (isProcessingStatus, isRefundedStatus, isEligibleForPayment) {
case (true, false, false):
// Order processing:
rows.append(.markCompleteButton(style: .primary, showsBottomSpacing: true))
default:
break
Expand Down Expand Up @@ -1822,7 +1797,6 @@ extension OrderDetailsDataSource {
comment: "The title for the refunded amount cell")
static let netAmount = NSLocalizedString("Net Payment", comment: "The title for the net amount paid cell")
static let collectPayment = NSLocalizedString("Collect Payment", comment: "Text on the button that starts collecting a card present payment.")
static let createShippingLabel = NSLocalizedString("Create Shipping Label", comment: "Text on the button that starts shipping label creation")
static let reprintShippingLabel = NSLocalizedString("Print Shipping Label", comment: "Text on the button that prints a shipping label")
static let seeReceipt = NSLocalizedString(
"OrderDetailsDataSource.configureSeeReceipt.button.title",
Expand Down Expand Up @@ -1855,9 +1829,6 @@ extension OrderDetailsDataSource {
static let payment = NSLocalizedString("Payment Totals", comment: "Payment section title")
static let notes = NSLocalizedString("Order Notes", comment: "Order notes section title")
static let customFields = NSLocalizedString("View Custom Fields", comment: "Custom Fields section title")
static let shippingLabelCreationInfoAction =
NSLocalizedString("Learn more about creating labels with your mobile device",
comment: "Title of button in order details > info link for creating a shipping label on the mobile device.")
static let shippingLabelPackageFormat =
NSLocalizedString("Package %d",
comment: "Order shipping label package section title format. The number indicates the index of the shipping label package.")
Expand Down Expand Up @@ -2022,8 +1993,6 @@ extension OrderDetailsDataSource {
case trackingAdd
case collectCardPaymentButton
case installWCShip
case shippingLabelCreateButton
case shippingLabelCreationInfo(showsSeparator: Bool)
case shippingLabelDetail
case shippingLabelPrintingInfo
case shippingLabelProducts
Expand Down Expand Up @@ -2085,10 +2054,6 @@ extension OrderDetailsDataSource {
return ButtonTableViewCell.reuseIdentifier
case .installWCShip:
return WCShipInstallTableViewCell.reuseIdentifier
case .shippingLabelCreateButton:
return ButtonTableViewCell.reuseIdentifier
case .shippingLabelCreationInfo:
return ImageAndTitleAndTextTableViewCell.reuseIdentifier
case .shippingLabelDetail:
return WooBasicTableViewCell.reuseIdentifier
case .shippingLabelPrintingInfo:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ final class OrderDetailsViewModel {
/// The eligibility check for Woo Shipping can be updated late due to being async
/// So the additional check for shipments determines if the new form should be displayed.
var shouldNavigateToNewShippingLabelFlow: Bool {
dataSource.isEligibleForWooShipping || dataSource.shipments.isNotEmpty
dataSource.isEligibleForWooShipping
}

private(set) lazy var editNoteViewModel: EditCustomerNoteViewModel = {
Expand Down Expand Up @@ -514,10 +514,6 @@ extension OrderDetailsViewModel {
forceReadOnly: false)
let navController = WooNavigationController(rootViewController: loaderViewController)
viewController.present(navController, animated: true, completion: nil)
case .shippingLabelCreationInfo:
let infoViewController = ShippingLabelCreationInfoViewController()
let navigationController = WooNavigationController(rootViewController: infoViewController)
viewController.present(navigationController, animated: true, completion: nil)
case .shippingLabelDetail:
guard let shippingLabel = dataSource.shippingLabel(at: indexPath) else {
return
Expand Down

This file was deleted.

12 changes: 0 additions & 12 deletions WooCommerce/WooCommerce.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@
02DFD5042B20486C0048CD70 /* ProductStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DFD5032B20486C0048CD70 /* ProductStepper.swift */; };
02DFD5062B2048C50048CD70 /* ProductStepperViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DFD5052B2048C50048CD70 /* ProductStepperViewModel.swift */; };
02DFD5082B205AEF0048CD70 /* ProductStepperViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DFD5072B205AEF0048CD70 /* ProductStepperViewModelTests.swift */; };
02DFECE725EE338F0070F212 /* ShippingLabelCreationInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DFECE625EE338F0070F212 /* ShippingLabelCreationInfoViewController.swift */; };
02E19B9C284743A40010B254 /* ProductImageUploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02E19B9B284743A40010B254 /* ProductImageUploader.swift */; };
02E222C829FBA60F004579A1 /* WooAnalyticsEvent+ProductFormAI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02E222C729FBA60F004579A1 /* WooAnalyticsEvent+ProductFormAI.swift */; };
02E262C9238D0AD300B79588 /* ProductStockStatusListSelectorCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02E262C8238D0AD300B79588 /* ProductStockStatusListSelectorCommand.swift */; };
Expand Down Expand Up @@ -3803,7 +3802,6 @@
02DFD5032B20486C0048CD70 /* ProductStepper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductStepper.swift; sourceTree = "<group>"; };
02DFD5052B2048C50048CD70 /* ProductStepperViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductStepperViewModel.swift; sourceTree = "<group>"; };
02DFD5072B205AEF0048CD70 /* ProductStepperViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductStepperViewModelTests.swift; sourceTree = "<group>"; };
02DFECE625EE338F0070F212 /* ShippingLabelCreationInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelCreationInfoViewController.swift; sourceTree = "<group>"; };
02E19B9B284743A40010B254 /* ProductImageUploader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductImageUploader.swift; sourceTree = "<group>"; };
02E222C729FBA60F004579A1 /* WooAnalyticsEvent+ProductFormAI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WooAnalyticsEvent+ProductFormAI.swift"; sourceTree = "<group>"; };
02E262C8238D0AD300B79588 /* ProductStockStatusListSelectorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductStockStatusListSelectorCommand.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6735,7 +6733,6 @@
children = (
CEAB739A2C81E3A000A7EB39 /* WooShipping Create Shipping Labels */,
DEE6437426D87C2D00888A75 /* Print Customs Form */,
02DFECE525EE33430070F212 /* Create Shipping Label Info */,
023D69BA2589BF2500F7DA72 /* Refund Shipping Label */,
023D69C52589BF5F00F7DA72 /* Print Shipping Label */,
53284F4A66A725F479CD9584 /* EUShippingNoticeTopBannerFactory.swift */,
Expand Down Expand Up @@ -7788,14 +7785,6 @@
path = "Beta features";
sourceTree = "<group>";
};
02DFECE525EE33430070F212 /* Create Shipping Label Info */ = {
isa = PBXGroup;
children = (
02DFECE625EE338F0070F212 /* ShippingLabelCreationInfoViewController.swift */,
);
path = "Create Shipping Label Info";
sourceTree = "<group>";
};
02E262C3238D04DB00B79588 /* ListSelector */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -15416,7 +15405,6 @@
2D88C1112DF883C300A6FB2C /* AttributedString+Helpers.swift in Sources */,
CE2A9FC623BFFADE002BEC1C /* RefundedProductsViewModel.swift in Sources */,
205B7EC32C19FC3000D14A36 /* PointOfSaleCardPresentPaymentConnectingToReaderAlertViewModel.swift in Sources */,
02DFECE725EE338F0070F212 /* ShippingLabelCreationInfoViewController.swift in Sources */,
093B265527DE8F020026F92D /* UnitInputViewModel+BulkUpdatePrice.swift in Sources */,
02C7EE8C2B22B21D008B7DF8 /* CollapsibleProductRowCardViewModel.swift in Sources */,
0245465F24EE9106004F531C /* ProductVariationFormEventLogger.swift in Sources */,
Expand Down
Loading