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

Allow selecting different variant options, respect available for sale #181

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kiftio
Copy link
Contributor

@kiftio kiftio commented Jan 2, 2025

What changes are you making?

Allow selecting different variant options, respect available for sale

How to test

I've added variants to the cat palm product in the checkout store for testing

variants.mp4

Before you merge

Important


Checklist for releasing a new version

Tip

See the Contributing documentation for instructions on how to publish a new version of the library.

@@ -95,6 +96,7 @@ fun CartItem(
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.secondary,
)
BodySmall(cartLine.variantDescription)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

display selected options on the cart page

Copy link

@leandrooriente leandrooriente Jan 2, 2025

Choose a reason for hiding this comment

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

What happens with products without variantDescription?

edit:
nvm, it's a non-nullable attribute

MoneyText(
currency = product.priceRange.maxVariantPrice.currencyCode,
price = product.priceRange.maxVariantPrice.amount,
MoneyRangeText(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should be a range for products with differently priced variants

}

QuantitySelector(enabled = true, quantity = productUIState.addQuantityAmount) { quantity ->
productViewModel.setAddQuantityAmount(quantity)
}

AddToCartButton(
enabled = productUIState.selectedVariant.availableForSale,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

disable add to cart if the selected variant is not available for sale

@@ -52,14 +52,14 @@ class ProductRepository(
if (products == null) {
continuation.resumeWith(Result.failure(RuntimeException("Failed to fetch products")))
} else {
val products = Products(
val result = Products(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

small fix for the var name products being shadowed

@kiftio kiftio marked this pull request as ready for review January 2, 2025 14:13
@kiftio kiftio requested a review from a team as a code owner January 2, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants