Skip to content

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

Convert values to decimals

dominik-zeglen33aec844796f
diff --git a/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx b/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx
index 267890367f..891c56b639 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleDetails/index.tsx
@@ -21,7 +21,7 @@ import { SearchCategoriesProvider } from "../../../containers/SearchCategories";
import { SearchCollectionsProvider } from "../../../containers/SearchCollections";
import { SearchProductsProvider } from "../../../containers/SearchProducts";
import i18n from "../../../i18n";
-import { getMutationState, maybe } from "../../../misc";
+import { decimal, getMutationState, maybe } from "../../../misc";
import { productUrl } from "../../../products/urls";
import { DiscountValueTypeEnum, SaleType } from "../../../types/globalTypes";
import SaleDetailsPage, {
@@ -285,7 +285,9 @@ export const SaleDetails: React.StatelessComponent<SaleDetailsProps> = ({
type: discountValueTypeEnum(
formData.type
),
- value: formData.value
+ value: decimal(
+ formData.value
+ )
}
}
})
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx b/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx
index 4d2371f567..8a32d36e39 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherDetails/index.tsx
@@ -21,7 +21,7 @@ import { SearchCategoriesProvider } from "../../../containers/SearchCategories";
import { SearchCollectionsProvider } from "../../../containers/SearchCollections";
import { SearchProductsProvider } from "../../../containers/SearchProducts";
import i18n from "../../../i18n";
-import { getMutationState, maybe } from "../../../misc";
+import { decimal, getMutationState, maybe } from "../../../misc";
import { productUrl } from "../../../products/urls";
import {
DiscountValueTypeEnum,
@@ -327,8 +327,9 @@ export const VoucherDetails: React.StatelessComponent<VoucherDetailsProps> = ({
variables: {
id,
input: {
- discountValue:
- formData.value,
+ discountValue: decimal(
+ formData.value
+ ),
discountValueType: discountValueTypeEnum(
formData.discountType
),