discounted configurables

This commit is contained in:
merdan 2022-04-21 16:54:29 +05:00
parent c4c2b9598c
commit 3a8ecf6803
1 changed files with 1 additions and 1 deletions

View File

@ -215,7 +215,7 @@ class Product extends JsonResource
'color_count' => $this->variants->groupBy('color')->count(),
];
if( $special_variant = $this->variants->whereNotNull('special_price')->orderBy('special_price')->first()){
if( $special_variant = $this->variants->whereNotNull('special_price')->sortBy('special_price')->first()){
$data = array_merge($data, [
'special_price' => $special_variant->special_price,
'formatted_special_price' => core()->currency($special_variant->special_price),