feat(core-flows, product): options checks on product create/update (#9171)
**What** - validate that variants are unique with respect to options on product update/create and variant update/create - validate that the product has options upon creation - ensure variants have the same number of option values as the product has options - admin error handling - update tests --- FIXES FRMW-2707 CC-556
This commit is contained in:
@@ -115,6 +115,9 @@ export const ProductEditVariantForm = ({
|
||||
handleSuccess("../")
|
||||
toast.success(t("products.variant.edit.success"))
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error(error.message)
|
||||
},
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { Button, ProgressStatus, ProgressTabs } from "@medusajs/ui"
|
||||
import { Button, ProgressStatus, ProgressTabs, toast } from "@medusajs/ui"
|
||||
import { useFieldArray, useForm, useWatch } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
@@ -207,7 +207,7 @@ export const CreateProductVariantForm = ({
|
||||
await mutateAsync(
|
||||
{
|
||||
title,
|
||||
sku,
|
||||
sku: sku || undefined,
|
||||
allow_backorder,
|
||||
manage_inventory,
|
||||
options: data.options,
|
||||
@@ -249,6 +249,9 @@ export const CreateProductVariantForm = ({
|
||||
onSuccess: () => {
|
||||
handleSuccess()
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error(error.message)
|
||||
},
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user