Skip to content
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

[Woo POS][Non-Simple Products] Add variation to cart #12926

Merged
merged 30 commits into from
Nov 22, 2024

Conversation

AnirudhBhat
Copy link
Contributor

@AnirudhBhat AnirudhBhat commented Nov 15, 2024

Closes: #12845

Description

This PR adds variation to the cart when clicked from the variations list screen.

Testing information

Try adding different variations of a variable product to the cart and ensure they all get added to the cart with correct name and variation attribute.

The tests that have been performed

Adding different variations to the cart in both dark and light mode.

  1. Navigate to the POS mode (more menu -> POS)
  2. Select any variable product
  3. Ensure you navigate to the variations list screen
  4. Click on any variation
  5. Ensure that variation gets added to the cart

Images/gif

add_variation_to_cart_demo.mp4
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

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 big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@AnirudhBhat AnirudhBhat added type: task An internally driven task. feature: point of sale POS project labels Nov 15, 2024
@AnirudhBhat AnirudhBhat added this to the 21.2 milestone Nov 15, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 15, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit1daccc8
Direct Downloadwoocommerce-wear-prototype-build-pr12926-1daccc8.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 15, 2024

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

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit1daccc8
Direct Downloadwoocommerce-prototype-build-pr12926-1daccc8.apk

@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 75.36232% with 17 lines in your changes missing coverage. Please review.

Project coverage is 39.61%. Comparing base (4e26906) to head (1daccc8).
Report is 221 commits behind head on trunk.

Files with missing lines Patch % Lines
...android/ui/woopos/home/cart/WooPosCartViewModel.kt 74.41% 7 Missing and 4 partials ⚠️
...id/ui/woopos/common/data/WooPosGetVariationById.kt 0.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #12926      +/-   ##
============================================
+ Coverage     39.59%   39.61%   +0.02%     
- Complexity     5956     5965       +9     
============================================
  Files          1267     1268       +1     
  Lines         73179    73214      +35     
  Branches      10048    10052       +4     
============================================
+ Hits          28976    29006      +30     
- Misses        41629    41633       +4     
- Partials       2574     2575       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@AnirudhBhat AnirudhBhat marked this pull request as ready for review November 18, 2024 04:14
…45-add-variation-to-cart

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/variations/WooPosVariationsViewModel.kt
#	WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/home/variations/WooPosVariationsViewModelTest.kt
…45-add-variation-to-cart

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItem.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewModel.kt
#	WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/home/items/LeftPaneNavigatorTest.kt
#	WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewModelTest.kt
…45-add-variation-to-cart

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/variations/WooPosVariationsScreen.kt
…45-add-variation-to-cart

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/variations/WooPosVariationsViewModel.kt
#	WooCommerce/src/test/kotlin/com/woocommerce/android/ui/products/ProductTestUtils.kt
Base automatically changed from issue/12844-fetch-variations to trunk November 21, 2024 04:58
@samiuelson samiuelson self-assigned this Nov 21, 2024
@wpmobilebot wpmobilebot modified the milestones: 21.2, 21.3 Nov 22, 2024
@wpmobilebot
Copy link
Collaborator

Version 21.2 has now entered code-freeze, so the milestone of this PR has been updated to 21.3.

Copy link
Collaborator

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

LGTM

is ParentToChildrenEvent.BackFromCheckoutToCartClicked -> handleBackFromCheckoutToCartClicked()
is ParentToChildrenEvent.ItemClickedInProductSelector -> handleItemClickedInProductSelector(event)
is ParentToChildrenEvent.OrderSuccessfullyPaid -> handleOrderSuccessfullyPaid()
is ParentToChildrenEvent.CheckoutClicked -> handleCheckoutClicked()
Copy link
Collaborator

Choose a reason for hiding this comment

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

💡 np.: It's a bit confusing to redirect to an empty function (handleCheckoutClicked()). How about this?

Suggested change
is ParentToChildrenEvent.CheckoutClicked -> handleCheckoutClicked()
is ParentToChildrenEvent.CheckoutClicked -> Unit

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: 1daccc8

@AnirudhBhat AnirudhBhat merged commit ecc710e into trunk Nov 22, 2024
15 checks passed
@AnirudhBhat AnirudhBhat deleted the issue/12845-add-variation-to-cart branch November 22, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: point of sale POS project type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[POS][Non-Simple Product type] Add variation to cart when clicked
4 participants