diff --git a/packages/Sarga/API/Http/Resources/Catalog/Product.php b/packages/Sarga/API/Http/Resources/Catalog/Product.php index 486fcc958..f077bb180 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/Product.php +++ b/packages/Sarga/API/Http/Resources/Catalog/Product.php @@ -106,17 +106,17 @@ class Product extends JsonResource $productTypeInstance = $product->getTypeInstance(); return [ - 'special_price' => (double) $this->when( + 'special_price' => $this->when( $productTypeInstance->haveSpecialPrice(), - core()->convertPrice($productTypeInstance->getSpecialPrice()) + (double) core()->convertPrice($productTypeInstance->getSpecialPrice()) ), 'formatted_special_price' => $this->when( $productTypeInstance->haveSpecialPrice(), core()->currency($productTypeInstance->getSpecialPrice()) ), - 'regular_price' => (double) $this->when( + 'regular_price' => $this->when( $productTypeInstance->haveSpecialPrice(), - data_get($productTypeInstance->getProductPrices(), 'regular_price.price') + (double) data_get($productTypeInstance->getProductPrices(), 'regular_price.price') ), 'formatted_regular_price' => $this->when( $productTypeInstance->haveSpecialPrice(), diff --git a/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php b/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php index 22c664e7f..b46403d91 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php +++ b/packages/Sarga/API/Http/Resources/Catalog/ProductVariant.php @@ -98,17 +98,17 @@ class ProductVariant extends JsonResource $productTypeInstance = $product->getTypeInstance(); return [ - 'special_price' => (double) $this->when( + 'special_price' => $this->when( $productTypeInstance->haveSpecialPrice(), - core()->convertPrice($productTypeInstance->getSpecialPrice()) + (double) core()->convertPrice($productTypeInstance->getSpecialPrice()) ), 'formatted_special_price' => $this->when( $productTypeInstance->haveSpecialPrice(), core()->currency($productTypeInstance->getSpecialPrice()) ), - 'regular_price' => (double) $this->when( + 'regular_price' => $this->when( $productTypeInstance->haveSpecialPrice(), - data_get($productTypeInstance->getProductPrices(), 'regular_price.price') + (double) data_get($productTypeInstance->getProductPrices(), 'regular_price.price') ), 'formatted_regular_price' => $this->when( $productTypeInstance->haveSpecialPrice(),