You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ALFMOB-162: Improve Wishlist Functionality on PLP & Wishlist
- Created `WishlistProduct` and `BagProduct` inheriting from `SelectedProduct`.
- Made `WishlistProduct` unique by **product ID and color ID**.
- Made `BagProduct` unique by **product ID and variant SKU**.
- Removed size information from `WishlistView` and `ProductListingView`.
- Updated **"Add to Bag"** action in `WishlistView` to redirect users to **PDP** for size selection instead of adding directly to the bag.
- Disabled **"Add to Bag"** button on **PDP** until both **color** (pre-selected) and **size** have been selected.
log.debug("Unexpected data inconsistency: tried to select color \(colorSwatch.id) on product \(productId) but no variant exists with that color, ignoring selection")
361
381
return
362
382
}
363
383
364
-
state =.success(.init(product: product, selectedVariant: variant))
384
+
letupdatedVariant=Product.Variant(
385
+
sku: variant.sku,
386
+
size: selectedVariant?.size, // Making sure if no size selected, it will not auto select
387
+
colour: variant.colour,
388
+
attributes: variant.attributes,
389
+
stock: variant.stock,
390
+
price: variant.price
391
+
)
392
+
393
+
state =.success(.init(product: product, selectedVariant: updatedVariant))
365
394
}
366
395
367
396
privatefunc didSelect(sizingSwatch:SizingSwatch){
@@ -371,14 +400,26 @@ final class ProductDetailsViewModel: ProductDetailsViewModelProtocol {
log.debug("Unexpected data inconsistency: tried to select size \(sizingSwatch.id) on product \(productId) but no variant exists with that size, ignoring selection")
378
410
return
379
411
}
380
412
381
-
state =.success(.init(product: product, selectedVariant: variant))
413
+
letupdatedVariant=Product.Variant(
414
+
sku: variant.sku,
415
+
size: variant.size,
416
+
colour: selectedVariant?.colour, // Making sure if no color selected, it will not auto select
417
+
attributes: variant.attributes,
418
+
stock: variant.stock,
419
+
price: variant.price
420
+
)
421
+
422
+
state =.success(.init(product: product, selectedVariant: updatedVariant))
382
423
}
383
424
384
425
privatevarselectedProduct:SelectedProduct?{
@@ -391,4 +432,4 @@ final class ProductDetailsViewModel: ProductDetailsViewModelProtocol {
0 commit comments