Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Mar 25, 2025

Closes: #15416

Description

This PR provides a first step for providing coupons from the service/controller to be rendered in the ItemList view, as well as an initial test suite for the coupons controller.

At the moment we only handle loading the first page of coupons on a happy path (the store has to have coupons). Unhappy paths/pagination/reload have not been handled yet.

Screen.Recording.2025-03-26.at.12.22.33.mov

Testing information

In a POS store, with coupons created:

  • Observe that coupons render using the existing CouponRowView and can be added to the cart
  • Observe that we cannot create an order only with coupons, at least a product is needed in the cart to checkout
  • Observe we can remove coupons from the cart

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

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@iamgabrielma iamgabrielma added feature: coupons Related to basic fulfillment such as order tracking. feature: POS labels Mar 25, 2025
@iamgabrielma iamgabrielma added this to the 22.1 milestone Mar 25, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Mar 25, 2025

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

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr15417-38b15ce
Version22.0
Bundle IDcom.automattic.alpha.woocommerce
Commit38b15ce
App Center BuildWooCommerce - Prototype Builds #13415
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@iamgabrielma iamgabrielma marked this pull request as ready for review March 26, 2025 06:00
@iamgabrielma iamgabrielma changed the title [Woo POS] Coupons: Provide coupons to ItemList [Woo POS] Coupons: Provide coupons to ItemList (happy path) Mar 26, 2025
@iamgabrielma iamgabrielma requested a review from staskus March 26, 2025 06:07
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

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

Thanks! Works well. 👍 And I like that the required changes with the Item list and aggregate model are much smallethanat I anticipated. At least for now.

I found one weird issue, though. It's most likely unrelated to this but could be related to my work on applying coupons or maybe it's some older issue.

Even though I only have one product in a cart, we send request with two products and it fails because such product doesn't exist:

image

This is a POSProductForRemoval:

image

I'm not yet sure what is is. I'll check now. [Woo POS] Coupons: Investigate adding invalid coupon and removing it keeps order in error state · Issue #15426 · woocommerce/woocommerce-ios

Button(action: {
posModel.addToCart(item)
}, label: {
CouponRowView(couponItem: .init(id: coupon.id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Great to see both list and cart functionality integrating so easily 👍

@staskus staskus merged commit 1241471 into trunk Mar 26, 2025
18 of 20 checks passed
@staskus staskus deleted the task/15416-pos-provide-coupons-to-ui branch March 26, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: coupons Related to basic fulfillment such as order tracking. feature: POS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Woo POS] Coupons: Provide coupons from controller/service to the UI

4 participants