Fix TypeError: unit_price.toFixed is not a function in SupplierProductManager
- Convert unit_price to Number before calling toFixed() on line 239 - Handles cases where unit_price may be a string, null, or undefined - Uses fallback to 0 for invalid values to prevent runtime errors This fixes the error that occurred when displaying supplier product prices in the onboarding supplier step.
This commit is contained in:
@@ -236,7 +236,7 @@ export const SupplierProductManager: React.FC<SupplierProductManagerProps> = ({
|
||||
{getProductName(priceList.inventory_product_id)}
|
||||
</span>
|
||||
<span className="text-[var(--text-secondary)] ml-2">
|
||||
€{priceList.unit_price.toFixed(2)}/{priceList.unit_of_measure}
|
||||
€{Number(priceList.unit_price || 0).toFixed(2)}/{priceList.unit_of_measure}
|
||||
</span>
|
||||
{priceList.minimum_order_quantity && priceList.minimum_order_quantity > 1 && (
|
||||
<span className="text-xs text-[var(--text-secondary)] ml-2">
|
||||
|
||||
Reference in New Issue
Block a user