$this->id, 'sku' => $this->sku, 'type' => $this->type, 'name' => $this->name, 'product' => $this->when($this->product_id, new CartItemProduct($this->child->product ?? $this->product)), 'coupon_code' => $this->coupon_code, 'weight' => (double) $this->weight, 'total_weight' => (double) $this->total_weight, 'qty_ordered' => (int) $this->qty_ordered, 'qty_canceled' => (int) $this->qty_canceled, 'qty_invoiced' => (int) $this->qty_invoiced, 'qty_shipped' => (int) $this->qty_shipped, 'qty_refunded' => (int) $this->qty_refunded, 'price' => (double) $this->price, 'formatted_price' => core()->formatPrice($this->price, $this->order->order_currency_code), 'total' => (double) $this->total, 'formatted_total' => core()->formatPrice($this->total, $this->order->order_currency_code), 'total_invoiced' => (double) $this->total_invoiced, 'formatted_total_invoiced' => core()->formatPrice($this->total_invoiced, $this->order->order_currency_code), 'amount_refunded' => (double) $this->amount_refunded, 'formatted_amount_refunded' => core()->formatPrice($this->amount_refunded, $this->order->order_currency_code), 'discount_percent' => (double) $this->discount_percent, 'discount_amount' => (double) $this->discount_amount, 'formatted_discount_amount' => core()->formatPrice($this->discount_amount, $this->order->order_currency_code), 'discount_invoiced' => (double) $this->discount_invoiced, 'formatted_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order->order_currency_code), 'discount_refunded' => (double) $this->discount_refunded, 'formatted_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order->order_currency_code), 'grant_total' => $this->total + $this->tax_amount, 'formatted_grant_total' => core()->formatPrice($this->total + $this->tax_amount, $this->order->order_currency_code), // 'downloadable_links' => $this->downloadable_link_purchased, // 'additional' => is_array($this->resource->additional) // ? $this->resource->additional // : json_decode($this->resource->additional, true), 'main_product' => new Product($this->product), // 'children' => Self::collection($this->children), ]; } }