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")
366
384
return
367
385
}
368
386
369
-
state =.success(.init(product: product, selectedVariant: variant))
387
+
letupdatedVariant=Product.Variant(
388
+
sku: variant.sku,
389
+
size: selectedVariant?.size, // Making sure if no size selected, it will not auto select
390
+
colour: variant.colour,
391
+
attributes: variant.attributes,
392
+
stock: variant.stock,
393
+
price: variant.price
394
+
)
395
+
396
+
state =.success(.init(product: product, selectedVariant: updatedVariant))
370
397
}
371
398
372
399
privatefunc didSelect(sizingSwatch:SizingSwatch){
@@ -376,14 +403,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")
383
413
return
384
414
}
385
415
386
-
state =.success(.init(product: product, selectedVariant: variant))
416
+
letupdatedVariant=Product.Variant(
417
+
sku: variant.sku,
418
+
size: variant.size,
419
+
colour: selectedVariant?.colour, // Making sure if no color selected, it will not auto select
420
+
attributes: variant.attributes,
421
+
stock: variant.stock,
422
+
price: variant.price
423
+
)
424
+
425
+
state =.success(.init(product: product, selectedVariant: updatedVariant))
387
426
}
388
427
389
428
privatevarselectedProduct:SelectedProduct?{
@@ -396,4 +435,4 @@ final class ProductDetailsViewModel: ProductDetailsViewModelProtocol {
0 commit comments