Skip to content

[Woo POS] Ensure auto-draft order removal on exit POS #15975

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

Draft
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Aug 5, 2025

Closes WOOMOB-88

Description

This PR addresses .autodraft orders not being deleted from storage when we exit POS after checkout, but before completing a payment.

The draft order is created in local storage when we perform POSOrderService.syncOrder(), and should be cleared after collecting a payment and starting a new order. The issue is that clearOrder(), triggered on exiting POS, only clears the in-memory order reference but doesn't delete the autodraft order from the local storage/database. So if payment is not finished and switches the order status, then the autodraft order remains persisted in CoreData until manually refreshed (we can see it disappear as soon as we pull-to-refresh in order list)

Changes

  • Upon calling the existing clearOrder() on exiting POS, if we're holding a reference to an order and this is set to autodraft (which only happens between checkout and payment collection) then we delete it.

Steps to reproduce / Testing information

  • Using a physical device, enter POS and connect the card reader (physical reader is necessary)
  • Add some products to the order and checkout
  • Before collecting payment, exit POS and navigate to Orders
  • If you are fast enough, you'll see the draft disappear when the order view is loaded, otherwise you should not see the draft order.
  • On a new order, confirm that can be completed via card payment, and we can start to a new order normally.

My iPad seems to have died, so I used a physical iPhone and removed the ipad/width restrictions for testing. Sorry for the video!

auto-draft.auto-removed.mp4

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

@iamgabrielma iamgabrielma added type: task An internally driven task. feature: order creation All tasks related to creating an order feature: POS Bug labels Aug 5, 2025
@iamgabrielma iamgabrielma added this to the 23.0 milestone Aug 5, 2025
@dangermattic
Copy link
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Aug 5, 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 Numberpr15975-fc81997
Version22.9
Bundle IDcom.automattic.alpha.woocommerce
Commitfc81997
Installation URL2p7m78n05t458
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@iamgabrielma iamgabrielma modified the milestones: 23.0, 23.1 Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug feature: order creation All tasks related to creating an order feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants