diff --git a/.changeset/silent-bears-teach.md b/.changeset/silent-bears-teach.md new file mode 100644 index 0000000000000..9148a47c8d998 --- /dev/null +++ b/.changeset/silent-bears-teach.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +fix(dashboard): Add Metadata form to Variant page diff --git a/packages/admin/dashboard/src/providers/router-provider/route-map.tsx b/packages/admin/dashboard/src/providers/router-provider/route-map.tsx index a29027cd8e2d6..bd593ad93e4b1 100644 --- a/packages/admin/dashboard/src/providers/router-provider/route-map.tsx +++ b/packages/admin/dashboard/src/providers/router-provider/route-map.tsx @@ -174,6 +174,13 @@ export const RouteMap: RouteObject[] = [ "../../routes/product-variants/product-variant-manage-inventory-items" ), }, + { + path: "metadata/edit", + lazy: () => + import( + "../../routes/product-variants/product-variant-metadata" + ), + }, ], }, ], diff --git a/packages/admin/dashboard/src/routes/product-variants/product-variant-metadata/index.ts b/packages/admin/dashboard/src/routes/product-variants/product-variant-metadata/index.ts new file mode 100644 index 0000000000000..b0e173a051fe5 --- /dev/null +++ b/packages/admin/dashboard/src/routes/product-variants/product-variant-metadata/index.ts @@ -0,0 +1 @@ +export { ProductVariantMetadata as Component } from "./product-variant-metadata" diff --git a/packages/admin/dashboard/src/routes/product-variants/product-variant-metadata/product-variant-metadata.tsx b/packages/admin/dashboard/src/routes/product-variants/product-variant-metadata/product-variant-metadata.tsx new file mode 100644 index 0000000000000..137fbf40e54df --- /dev/null +++ b/packages/admin/dashboard/src/routes/product-variants/product-variant-metadata/product-variant-metadata.tsx @@ -0,0 +1,30 @@ +import { useParams } from "react-router-dom" +import { MetadataForm } from "../../../components/forms/metadata-form/metadata-form" +import { useProductVariant, useUpdateProductVariant } from "../../../hooks/api" + +export const ProductVariantMetadata = () => { + const { id, variant_id } = useParams() + + const { variant, isPending, isError, error } = useProductVariant( + id!, + variant_id! + ) + + const { mutateAsync, isPending: isMutating } = useUpdateProductVariant( + id!, + variant_id! + ) + + if (isError) { + throw error + } + + return ( + + ) +}