customer = $customer; $this->lastActivityAt = $lastActivityAt; $this->productIds = $productIds; } public function getLastActivityAt(): \DateTimeImmutable { return $this->lastActivityAt; } public function getCustomer(): \WC_Customer { return $this->customer; } /** * @return int[] */ public function getProductIds(): array { return $this->productIds; } public function getTotal(): float { $total = 0.0; foreach ($this->productIds as $productId) { $product = wc_get_product($productId); if ($product) { $total += (float)$product->get_price(); } } return $total; } }