diff --git a/src/app/features/store/pages/product-detail-page/product-detail-page.component.ts b/src/app/features/store/pages/product-detail-page/product-detail-page.component.ts index db65834..2722d3b 100644 --- a/src/app/features/store/pages/product-detail-page/product-detail-page.component.ts +++ b/src/app/features/store/pages/product-detail-page/product-detail-page.component.ts @@ -140,6 +140,8 @@ export class ProductDetailPageComponent implements OnInit, OnDestroy { this.productSub = this.catalogService.getProducto(id).subscribe({ next: (prod) => { this.product.set(prod); + const matchingVariant = prod.variants_map.find((v) => v.variant_id === prod.variant?.id) || null; + this.selectedVariant.set(matchingVariant); this.quantity.set(1); this.descriptionExpanded.set(false); this.descriptionHasOverflow.set(false); @@ -159,6 +161,8 @@ export class ProductDetailPageComponent implements OnInit, OnDestroy { this.productSub = this.catalogService.getProducto(productId, variantId).subscribe({ next: (prod) => { this.product.set(prod); + const matchingVariant = prod.variants_map.find((v) => v.variant_id === prod.variant?.id) || null; + this.selectedVariant.set(matchingVariant); this.variantLoading.set(false); }, error: (err: HttpErrorResponse) => {