From 95cd8c69020f5e05efd171bb8f25a09ebecee117 Mon Sep 17 00:00:00 2001 From: Afaz Khatri Date: Fri, 9 Oct 2020 20:21:38 +0530 Subject: [PATCH] Updated the regular price key --- packages/Webkul/API/Http/Resources/Catalog/Product.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/Webkul/API/Http/Resources/Catalog/Product.php b/packages/Webkul/API/Http/Resources/Catalog/Product.php index edf0ec0f0..3414aafdd 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Product.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Product.php @@ -30,6 +30,8 @@ class Product extends JsonResource public function toArray($request) { $product = $this->product ? $this->product : $this; + + $prices = $product->getTypeInstance()->getProductPrices(); return [ 'id' => $product->id, @@ -56,7 +58,8 @@ class Product extends JsonResource $product->getTypeInstance()->haveSpecialPrice(), core()->currency($product->getTypeInstance()->getSpecialPrice()) ), - 'prices' => $product->getTypeInstance()->getProductPrices(), + 'regular_price' => data_get($prices, 'regular_price.price'), + 'formatted_regular_price' => data_get($prices, 'regular_price.formated_price'), 'reviews' => [ 'total' => $total = $this->productReviewHelper->getTotalReviews($product), 'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0,