Skip to content

Shipping Labels: Show shipment details on order details screen #15889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Jul 17, 2025

Conversation

itsmeichigo
Copy link
Contributor

@itsmeichigo itsmeichigo commented Jul 9, 2025

Closes WOOMOB-754

Description

This PR updates the shipping label section on the order details screen. The screen now displays details of the shipments created for an order. Shipments are synced with the local storage to ensure fetched data are displayed instantly when reopening an order.

More specifically:

  • Updates WooShippingStore to persist purchased labels and update shipments after requesting refund for a label. This is to ensure that the order details screen is updated instantly after purchasing/refunding labels.
  • Updates the order details screen's data source to:
    • Display the Create shipping label button in the Products section only if no shipment has been created for an order.
    • Display the ellipsis menu with the create shipping label option in the Products section only for the legacy shipping plugin.
    • Configure shipment section and detail rows.
  • Adds new SwiftUI view for the content of shipment details row.
  • Handles actions on the shipment details row.

Testing steps

TC1: Store with Woo Shipping extension

  1. Create an order with several physical items for the store > Collect payment for that order.
  2. Select the order and confirm that the Shipping Labels section is not available.
  3. Select Create shipping label button.
  4. Split items into different shipments > Save changes > Dismiss the purchase flow.
  5. Confirm that the order details then displays the shipments instantly.
  6. Confirm that the Create shipping label button in the Products section is hidden, and buttons on unfulfilled shipments are available.
  7. Confirm that items on each shipment are correct.
  8. Tap Create shipping label on one of the shipments. Confirm that the correct shipment is open.
  9. Proceed to purchase a label for the shipment then dismiss the purchase form. Confirm that the shipment is updated to the fulfilled state instantly on the order details screen.
  10. Tap the ellipsis menu on the same shipment and select Request a refund.
  11. Proceed to refund the label of that shipment. Confirm that after completion, the shipment is displayed with a text saying the purchase label has been refunded.
  12. Purchase a label for a shipment with an international address. Confirm that the print customs form is option is available in the corresponding shipment's ellipsis menu.

TC2: Store with the legacy Woo Tax extension

  1. Create an order with several physical items for the store > Collect payment for that order.
  2. Select the order and purchase labels.
  3. Confirm that labels are displayed like previously.

Testing information

  • Tested 2 test cases above with simulator iPhone 16 iOS 18.4.
  • Added unit tests for WooShippingStore to confirm persistence logic.

Screenshots

Store with Woo Tax Store with Woo Shipping

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@itsmeichigo itsmeichigo added this to the 22.8 milestone Jul 9, 2025
@itsmeichigo itsmeichigo added type: task An internally driven task. feature: shipping labels Related to creating, ordering, or printing shipping labels. labels Jul 9, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Jul 9, 2025

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 9, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15889-504e7b3
Version22.8
Bundle IDcom.automattic.alpha.woocommerce
Commit504e7b3
Installation URL4hbvtecs89fv8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@itsmeichigo itsmeichigo modified the milestones: 22.8, 22.9 Jul 10, 2025
Base automatically changed from woomob-754-shipping-labels-update-shipping-label-section-in-order to trunk July 11, 2025 11:23
@itsmeichigo itsmeichigo changed the base branch from trunk to woomob-754-sync-shipments July 14, 2025 04:16
Base automatically changed from woomob-754-sync-shipments to trunk July 15, 2025 03:26
@itsmeichigo itsmeichigo marked this pull request as ready for review July 15, 2025 11:17
@RafaelKayumov RafaelKayumov self-assigned this Jul 16, 2025
Copy link
Contributor

@RafaelKayumov RafaelKayumov left a comment

Choose a reason for hiding this comment

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

LGTM. Tested on Woo Shipping extension only. Works as described. Left just a couple of nits.

And an observation - the "Create shipping label" is presented for a fraction of a second when the order details screen is presented 1st time after separate shipments already created.

Simulator.Screen.Recording.-.iPhone.16.-.2025-07-16.at.13.29.47.mp4

return nil
}
return Section(
category: .payment,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be .wooShipping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7414f16

@@ -446,6 +452,7 @@ private extension OrderDetailsViewController {
}

let shippingLabelCreationVM = WooShippingCreateLabelsViewModel(order: viewModel.order,
selectedShipmentIndex: shipmentIndex,
Copy link
Contributor

Choose a reason for hiding this comment

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

What will happen if we somehow pass an index that's different from the passed label's shipment?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we’d like to address those 2 types arguments, I’d say it could be as single argument with an enum type of .shipmentIndex(Int) and .shippingLabel(ShippingLabel) cases. With that we could explicitly specify the logic of pre-selecting a shipment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 6fa79d4 👍

@itsmeichigo
Copy link
Contributor Author

Thanks for the review @RafaelKayumov!

Regarding this:

And an observation - the "Create shipping label" is presented for a fraction of a second when the order details screen is presented 1st time after separate shipments already created.

I'm unsure how to fix this, I hope it's fine to leave it this way for now.

I added changes as suggested in subsequent commits. Could you please take another look to see if they're all good? 🙏

@@ -5,6 +5,18 @@ import Combine
import struct Networking.WooShippingAccountSettings
import enum Networking.DotcomError

enum WooShippingCreateLabelSelection {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@itsmeichigo itsmeichigo merged commit 21e9663 into trunk Jul 17, 2025
13 checks passed
@itsmeichigo itsmeichigo deleted the woomob-754-ui-updates branch July 17, 2025 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: shipping labels Related to creating, ordering, or printing shipping labels. type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants