Skip to content

Conversation

jaclync
Copy link
Contributor

@jaclync jaclync commented May 27, 2025

Fixes WOOPRD-536

  • @jaclync registers new event properties in affected events after the PR is approved

Description

This pull request enabled the local POS receipts feature flag, and added analytics for tracking receipt sneding success and failure for non-POS and POS receipts.

Analytics Plan from WOOPRD-535

  1. Adding eligible_for_pos_receipt property to pos_receipt_email_success and pos_receipt_email_failed events
    For this new event property:
  • If the eligibility check is not performed (e.g. receipt cannot be sent because there is no stored order as a potential case in iOS, or the first order update API request fails before the WC version check), this property is not included.
  • Value is a boolean when tracked.
  1. Tracking error in pos_receipt_email_failed event
    If pos_receipt_email_failed event currently does not track the error, let's also include the error details for us to understand more about the failure events. The error is tracked the same way as we track errors in other events.

Feature Flag Updates:

Error Handling Enhancements:

Analytics Tracking Testing:

Steps to reproduce

Store with WC version < 10.0.0 (not eligible for POS receipts)

Prerequisite: the store is eligible for POS

  • Go to the Menu tab
  • Enter POS
  • Add item(s) to cart, then check out
  • Pay with card or cash
  • In the success screen, tap Email receipt
  • Enter a valid email and tap to send --> pos_receipt_email_success event should have a property eligible_for_pos_receipt: false
  • In the success screen, tap Email receipt again
  • Turn off network to simulate network error. Enter a valid email and tap to send --> pos_receipt_email_failed event should not have a property eligible_for_pos_receipt: false (because the order sync API request fails and returns early before eligibility check) and error properties

Store with WC version >= 10.0.0 (eligible for POS receipts)

Prerequisite: the store is eligible for POS, and POS feature is enabled in WC Settings > Advanced > Features

  • Go to the Menu tab
  • Enter POS
  • Add item(s) to cart, then check out
  • Pay with card or cash
  • In the success screen, tap Email receipt
  • Enter a valid email and tap to send --> pos_receipt_email_success event should have a property eligible_for_pos_receipt: true
  • In the success screen, tap Email receipt again
  • Turn off network to simulate network error. Enter a valid email and tap to send --> pos_receipt_email_failed event should not have a property eligible_for_pos_receipt: true (because the order sync API request fails and returns early before eligibility check) and error properties

Optional - Store with WC version >= 10.0.0 with eceipt sending error

Prerequisite: the store is eligible for POS, and POS feature is enabled in WC Settings > Advanced > Features. Receipt sending fails, this can be simulated by updating the template ID to an invalid one like customer_pose_completed_order

  • Go to the Menu tab
  • Enter POS
  • Add item(s) to cart, then check out
  • Pay with card or cash
  • In the success screen, tap Email receipt
  • Enter a valid email and tap to send --> pos_receipt_email_failed event should have a property eligible_for_pos_receipt: true with error properties like error_description: Yosemite.POSReceiptService.POSReceiptServiceError.sendReceiptFailed(underlyingError: Dotcom Error: [rest_invalid_param] Invalid parameter(s): template_id)

Testing information

I tested all cases above on iPad Pro 11in 3rd gen iOS 18.5.


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

@jaclync jaclync added this to the 22.5 milestone May 27, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 27, 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 Number30107
VersionPR #15674
Bundle IDcom.automattic.alpha.woocommerce
Commitfc2acea
Installation URL7tdbl4cihhu10
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Base automatically changed from feat/WOOPRD-510-add-pos-feature-switch-value-to-eligibility to trunk May 28, 2025 00:13
@jaclync jaclync force-pushed the feat/WOOPRD-535-enable-pos-receipts-analytics branch from 5cc5102 to 66a3823 Compare May 28, 2025 02:20
}
} catch {
throw POSReceiptServiceError.sendReceiptFailed
throw POSReceiptServiceError.sendReceiptFailed(underlyingError: error as NSError)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🗒️ This allows better tracking of the underlying error in pos_receipt_email_failed event, otherwise the error just showed Yosemite.POSReceiptService.POSReceiptServiceError.sendReceiptFailed.

@jaclync jaclync marked this pull request as ready for review May 28, 2025 03:15
@iamgabrielma iamgabrielma self-assigned this May 28, 2025
@iamgabrielma
Copy link
Contributor

Store with WC version >= 10.0.0

@jaclync what's the best way to test WC 10+? The WC Beta tester plugin only reaches to 9.9.0-rc.1 (or you can send me access to a test store if you have one 👍 )

@jaclync
Copy link
Contributor Author

jaclync commented May 28, 2025

Store with WC version >= 10.0.0

@jaclync what's the best way to test WC 10+? The WC Beta tester plugin only reaches to 9.9.0-rc.1 (or you can send me access to a test store if you have one 👍 )

Apology for forgetting to link a test site, please check out the JN site linked in the comment in WOOPRD-535.

Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

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

✅ Store with WC version < 10.0.0
✅ Store with WC version >= 10.0.0

Works well! Tested on simulator iPad Pro M4 iOS 18.3 🚢

let isSupported = VersionHelpers.isVersionSupported(version: plugin.version,
minimumRequired: minimumVersion)
minimumRequired: minimumVersion,
includesDevAndBetaVersions: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

@jaclync
Copy link
Contributor Author

jaclync commented May 29, 2025

Just registered pos_receipt_email_success and pos_receipt_email_failed events (they weren't validated/registered before) with the properties added in this PR, merging now.

@jaclync jaclync merged commit 3258d2f into trunk May 29, 2025
17 checks passed
@jaclync jaclync deleted the feat/WOOPRD-535-enable-pos-receipts-analytics branch May 29, 2025 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants