[Woo POS] [Variable Products] Add variation to POSItem enum with variation card UI #14782
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #14701
Description
This pull request introduces a new POS item type to support variations in POS. The key changes include the addition of a new
VariationCardView
SwiftUI view that displays UI for a newPOSVariation
struct. The variation view will be shown in a future PR.Product Variations
WooCommerce/Classes/POS/Presentation/ItemListView.swift
: Added a new case for handling product variations in theItemListView
with a corresponding button and temporary print statement. The action will be replaced withposModel.addToCart(variation)
in a future PR.WooCommerce/Classes/POS/Presentation/VariationCardView.swift
: Introduced a newVariationCardView
component to display product variations. This view includes an image, name, and price of the variation.Yosemite/Yosemite/PointOfSale/POSVariation.swift
: Added a newPOSVariation
struct to represent product variations with properties forid
,name
,formattedPrice
, and an optionalproductImageSource
.Enum Update
Yosemite/Yosemite/PointOfSale/PointOfSaleItemServiceProtocol.swift
: Updated thePOSItem
enum to include a new case forvariation
, along with the correspondingid
property implementation.Steps to reproduce
Please test the new variation UI in SwiftUI previews, with different orientations, color schemes, and font sizes.
Testing information
I tested that POS functionality is not affected, no variations should be shown in the item selector.
Screenshots
Light/dark modes:
Different font sizes:
🗒️ The text font size doesn't seem to scale with dynamic type, probably because it's using a custom font.
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: