From f1418db4493a73b384925f2e096d9de43f1231c2 Mon Sep 17 00:00:00 2001 From: Dora Jurcevic Date: Thu, 15 Feb 2024 12:14:44 +0100 Subject: [PATCH] fix: product model prices fix --- models/Product.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/models/Product.ts b/models/Product.ts index 617cfc98..9463a2eb 100644 --- a/models/Product.ts +++ b/models/Product.ts @@ -122,11 +122,12 @@ export class Product extends Model { } this.sku = data?.sku || null this.variantAttributes = data?.variant_attributes || {} - const priceLists = Object.keys(data?.prices || {}) + const prices = data?.prices || data?.price || {} + const priceLists = Object.keys(prices) if(priceLists?.length > 0) { this.pricesList = {} for(let priceList of priceLists) { - this.pricesList[priceList] = new ProductPrice(data?.prices?.[priceList]) + this.pricesList[priceList] = new ProductPrice(prices?.[priceList]) } if(this.pricesList?.['default']) {