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