woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
277 stars 135 forks source link

[Woo POS][Non-Simple products] Detect variable products and add variation quantity #12872

Closed AnirudhBhat closed 1 week ago

AnirudhBhat commented 2 weeks ago

Closes: #12842

Description

This PR does 2 things:

  1. Refactor so that we can pass in relevant data required for product types - for instance, Simple product just needs ID for it to be added to cart but Variable product needs name and ids. This PR refactors such that it will be easy for us to extend it for future use cases as well (Custom amounts, discounts, coupons ...etc)

  2. Detect and display number of variations for Variable product just below the product name.

Design

Screenshot 2024-11-08 at 11 40 49 AM

Testing information

Create Variable products with different variations and ensure Variable products are displayed with correct number of variations in items list in POS mode.

Ensure you cannot add variable products to cart yet.

The tests that have been performed

Ensured correct number of variations are displayed for variable products in items list

Ensured variable products cannot be added to the cart

Images/gif

https://github.com/user-attachments/assets/c394405b-393d-44a4-8763-56d7ca51db41

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:

wpmobilebot commented 2 weeks ago
📲 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
Commitd5997f757e5a15747aed6859e061b917af2b0f8f
Direct Downloadwoocommerce-wear-prototype-build-pr12872-d5997f7.apk
wpmobilebot commented 2 weeks ago

📲 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
Commitd5997f757e5a15747aed6859e061b917af2b0f8f
Direct Downloadwoocommerce-prototype-build-pr12872-d5997f7.apk
codecov-commenter commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Project coverage is 40.26%. Comparing base (d978794) to head (d5997f7). Report is 270 commits behind head on trunk.

Files with missing lines Patch % Lines
...droid/ui/woopos/home/items/WooPosItemsViewModel.kt 88.23% 1 Missing and 1 partial :warning:
...erce/android/ui/woopos/home/WooPosHomeViewModel.kt 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## trunk #12872 +/- ## ============================================ + Coverage 40.25% 40.26% +0.01% - Complexity 5786 5790 +4 ============================================ Files 1249 1249 Lines 71174 71193 +19 Branches 9934 9937 +3 ============================================ + Hits 28651 28669 +18 - Misses 39889 39890 +1 Partials 2634 2634 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.