Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Wrap discount values into decimal

dominik-zeglen3407225012b2
diff --git a/saleor/static/dashboard-next/discounts/views/SaleCreate.tsx b/saleor/static/dashboard-next/discounts/views/SaleCreate.tsx
index c3ed41ab67..f72770106c 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleCreate.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleCreate.tsx
@@ -5,7 +5,7 @@ import Navigator from "../../components/Navigator";
import Shop from "../../components/Shop";
import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
-import { getMutationState, maybe } from "../../misc";
+import { decimal, getMutationState, maybe } from "../../misc";
import { DiscountValueTypeEnum, SaleType } from "../../types/globalTypes";
import SaleCreatePage from "../components/SaleCreatePage";
import { TypedSaleCreate } from "../mutations";
@@ -69,7 +69,7 @@ export const SaleDetails: React.StatelessComponent = () => (
? null
: formData.startDate,
type: discountValueTypeEnum(formData.type),
- value: formData.value
+ value: decimal(formData.value)
}
}
})
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherCreate.tsx b/saleor/static/dashboard-next/discounts/views/VoucherCreate.tsx
index f35ba15d63..0e30cb7a8c 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherCreate.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherCreate.tsx
@@ -5,7 +5,7 @@ import Navigator from "../../components/Navigator";
import Shop from "../../components/Shop";
import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
-import { getMutationState, maybe } from "../../misc";
+import { decimal, getMutationState, maybe } from "../../misc";
import {
DiscountValueTypeEnum,
VoucherDiscountValueType,
@@ -66,7 +66,7 @@ export const VoucherDetails: React.StatelessComponent = () => (
variables: {
input: {
code: formData.code,
- discountValue: formData.value,
+ discountValue: decimal(formData.value),
discountValueType: discountValueTypeEnum(
formData.discountType
),