sku; $product = $sku->product; $price = $sku->price; $description = $product->description; $subTotal = $price * $this->quantity; $image = $sku->image ?: $product->image; return [ 'cart_id' => $this->id, 'product_id' => $this->product_id, 'sku_id' => $this->product_sku_id, 'name' => sub_string($description->name), 'image' => $image, 'image_url' => image_resize($image), 'quantity' => $this->quantity, 'selected' => $this->selected, 'price' => $price, 'price_format' => currency_format($price), 'tax_class_id' => $product->tax_class_id, 'subtotal' => $subTotal, 'subtotal_format' => currency_format($subTotal), ]; } }