Skip to content

Conversation

@RafaelKayumov
Copy link
Contributor

@RafaelKayumov RafaelKayumov commented Jul 6, 2025

WOOMOB-746

Description

This is a follow up PR for the [Shipping Labels] Fix purchased labels not presenting destination address - addresses the "editable" origin address line in "Shipment details" bottom sheet for purchased labels. The line shouldn't be editable in case if a label is purchased.

The issue cause is the same as for the missing destination address. The selected_origin wasn't requested and therefore mapped from the config/label-purchase/{order_id} endpoint.

  • Adds config.shippingLabelData.storedData.selected_origin request parameter for the config/label-purchase/{order_id} endpoint.
  • Maps selected_origin content into ShippingLabels following the same logic implemented in #15866
  • Extends the WooShippingRemoteTests.swift to cover origin address mapping.
  • Adds a [just in case for safety] fallback in WooShippingCreateLabelsView to present the view model origin address in case if origin address lines from shipping labels are missing.

Steps to reproduce

  • Open a completed order with previously purchased labels. Or create an order and complete a label purchase for several shipments. For testing purposes make sure to purchase labels with different shipment origin addresses.
  • Open "Create shipping labels" flow for that order.
  • Expand the "Shipment details" bottom sheet.
  • Make sure the origin address line ("Ship from") is presented.
  • Make sure the origin address line ("Ship from") is not editable.
  • Make sure the origin address line ("Ship from") is presents different addresses for different fulfilled shipments.
  • Consider testing the same order on web to confirm behaviour parity.
  • Consider testing with Proxyman. Make sure the config/label-purchase/{order_id} endpoint request sends the config.shippingLabelData.storedData.selected_origin argument. Make sure the response contains selected_origin payload.

Testing information

  • Tested on iPhone 16 (iOS 18.4) Simulator. Confirmed that origin address are mapped an presented as non-editable lines in bottom sheet. For shipments with missing data the fallback address is presented.
  • WooShippingRemoteTests extended to cover origin address mapping.

Screenshots

Before After
Simulator Screenshot - iPhone 16 - 2025-07-06 at 16 59 40 Simulator Screenshot - iPhone 16 - 2025-07-06 at 16 56 17

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

@RafaelKayumov RafaelKayumov added this to the 22.7 ❄️ milestone Jul 6, 2025
@RafaelKayumov RafaelKayumov added type: bug A confirmed bug. feature: shipping labels Related to creating, ordering, or printing shipping labels. Bug labels Jul 6, 2025
@RafaelKayumov RafaelKayumov requested a review from itsmeichigo July 6, 2025 14:01
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 6, 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 Number31023
VersionPR #15872
Bundle IDcom.automattic.alpha.woocommerce
Commit548904a
Installation URL00lgarim0r8n0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Comment on lines +126 to +129
selectedOrigins = try? container.decodeIfPresent(
WooShippingLabelAddressMap.self,
forKey: CodingKeys.selectedOrigin
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please consider applying the same fix as suggested here to support the array case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 380 to 381
/// Fallback to `originAddress` in case if `originAddressLines` are missing
[viewModel.originAddress]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm concerned that this fallback may cause the app to display incorrect data. Do you think we can remove the workaround if we add support for the origin address array as suggested above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a strong preference here.

It would be either a blank space or the viewModel.originAddress fallback if selected_origin addresses aren't mapped for some reason. And it seems to be super rare for potential edge cases where a fallback wouldn't work.

I checked - web does present just a blank space for this case. But for the destination web does a fallback to the order destination address if the shipping label destination is missing.

@itsmeichigo Are we ok to leave a blank space there?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm good with having a blank space, it's easier to know that there's an issue than having incorrect data.

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 548904a

@RafaelKayumov RafaelKayumov requested a review from itsmeichigo July 7, 2025 12:39
Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

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

Thanks for the update. Just a note: when both addresses cannot be found, I see that the layout becomes horizontal:

I hope the workaround in #15876 would prevent this case to happen.

Base automatically changed from WOOMOB-746-fix-purchased-labels-address-fields to release/22.7 July 8, 2025 08:28
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 22.7 ❄️. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.
1 Message
📖 This PR contains changes to RELEASE-NOTES.txt.
Note that these changes won't affect the final version of the release notes as this version is in code freeze.
Please, get in touch with a release manager if you want to update the final release notes.

Generated by 🚫 Danger

@RafaelKayumov RafaelKayumov merged commit 2b8fdb8 into release/22.7 Jul 8, 2025
15 checks passed
@RafaelKayumov RafaelKayumov deleted the WOOMOB-746-handle-selected-origin branch July 8, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug feature: shipping labels Related to creating, ordering, or printing shipping labels. type: bug A confirmed bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants