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] Update Variation Name Display Logic #13332

Merged
merged 23 commits into from
Jan 22, 2025

Conversation

AnirudhBhat
Copy link
Contributor

@AnirudhBhat AnirudhBhat commented Jan 16, 2025

Closes: #13330

Description

This PR updates the logic for displaying the name of variable products. Previously, only the attribute value (e.g., Red) was shown. With this change, both the attribute name and value (e.g., Color:Red) will be displayed for better clarity and user understanding.

Changes

  1. Added new getNameForPOS function to include both attribute name and attribute value in the format {name}:{value}.
  2. Modified the separator from - to , for a cleaner and more intuitive representation of attributes.
  3. Display Parent product name in cart when variation is added to cart.

Steps to reproduce

  1. Navigate to POS (more menu -> POS)
  2. Click on any variable product
  3. Ensure you see variation name in the format {attribute name}:{attribute value}
  4. Add variation to cart
  5. Ensure you see parent product name, attributes, and price of variation in cart

The tests that have been performed

Tested above mentioned steps in both light and dark mode

Images/gif

variation_fill_name

  • 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 Jan 16, 2025
@AnirudhBhat AnirudhBhat added this to the 21.5 milestone Jan 16, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 16, 2025

📲 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
Commit2f7b30e
Direct Downloadwoocommerce-wear-prototype-build-pr13332-2f7b30e.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 16, 2025

📲 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
Commit2f7b30e
Direct Downloadwoocommerce-prototype-build-pr13332-2f7b30e.apk

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 55.55556% with 16 lines in your changes missing coverage. Please review.

Project coverage is 41.11%. Comparing base (f9da72a) to head (2f7b30e).
Report is 26 commits behind head on trunk.

Files with missing lines Patch % Lines
...home/items/variations/WooPosVariationsViewModel.kt 50.00% 10 Missing and 5 partials ⚠️
...id/ui/woopos/home/totals/WooPosTotalsRepository.kt 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #13332      +/-   ##
============================================
+ Coverage     41.10%   41.11%   +0.01%     
+ Complexity     6484     6481       -3     
============================================
  Files          1325     1325              
  Lines         77499    77527      +28     
  Branches      10669    10674       +5     
============================================
+ Hits          31856    31876      +20     
- Misses        42814    42819       +5     
- Partials       2829     2832       +3     

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

@samiuelson samiuelson self-assigned this Jan 17, 2025
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.

This works well, @AnirudhBhat. I left a couple of questions – let me know what are your thoughts.

if (option?.option != null) {
"${attribute.name}: ${option.option}"
} else {
"Any ${attribute.name}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ Shouldn't this be localized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, I believe "Any {attribute name}" is not localised in production as well. The reasoning is that "Any" functions like a generic dropdown option, similar to the other variation choices.

Copy link
Collaborator

@samiuelson samiuelson Jan 22, 2025

Choose a reason for hiding this comment

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

Hm. I'm not sure I understand why we don't want to localise it as "Any %s".

"Any {attribute name}" is not localised in production

Do you refer to Woo wp-admin? I think texts in the app are localised independently of the web (e.g. you can have english version of Wordpress on server and the Woo app localised to the language of the OS).

It's also translated on iOS, as you can see here: https://github.com/woocommerce/woocommerce-ios/blame/trunk/Yosemite/Yosemite/Tools/ProductVariations/VariationAttributeViewModel.swift#L53

Let me know in case I'm missing something here @AnirudhBhat.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@samiuelson Thanks for the review. I've added localisation only for the POS mode. Let me know what you think!

c5720e0

@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 21.5. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

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.

Thanks for your work @AnirudhBhat. LGTM :shipit:

@samiuelson samiuelson enabled auto-merge January 22, 2025 14:52
@samiuelson samiuelson merged commit 3d007ef into trunk Jan 22, 2025
15 checks passed
@samiuelson samiuelson deleted the issue/13330-variation-full-name branch January 22, 2025 15:16
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.

[Woo POS][Non-Simple Products] For variable product, use attribute name as well as value
5 participants