menu Controller

This commit is contained in:
merdan 2022-09-22 13:37:07 +05:00
parent b80dab368f
commit a176efe6e5
1 changed files with 7 additions and 1 deletions

View File

@ -83,7 +83,13 @@ class Product extends JsonResource
*/
private function specialPriceInfo()
{
$product = $this->type == 'configurable' ? $this->product->getTypeInstance()->getMinPriceVariant()->product : $this->product;
if($this->type == 'configurable')
{
$variant = $this->variants()->with('product')->orderBy('min_price')->first();
$product = $variant->product;
}else{
$product = $this->product ? $this->product : $this;
}
$typeInstance = $product->getTypeInstance();