Browse Source

fix(dashboard): Fix gross price display under price includes tax (#4138)

Qingbao Guo 1 day ago
parent
commit
37c2ff831b

+ 6 - 2
packages/dashboard/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx

@@ -70,8 +70,12 @@ export function VariantPriceDetail({
     }, [taxRatesData, activeChannel, taxCategoryId]);
     }, [taxRatesData, activeChannel, taxCategoryId]);
 
 
     useEffect(() => {
     useEffect(() => {
-        setGrossPrice(Math.round((price ?? 0) * ((100 + taxRate) / 100)));
-    }, [price, taxRate]);
+        if (priceIncludesTax) {
+            setGrossPrice(price ?? 0);
+        } else {
+            setGrossPrice(Math.round((price ?? 0) * ((100 + taxRate) / 100)));
+        }
+    }, [price, taxRate, priceIncludesTax]);
 
 
     return (
     return (
         <div className="space-y-1">
         <div className="space-y-1">