fix(medusa): Product import - allow null product type (#2424)
**What**
- allow the product type field to be null
**How**
- in case the type is `null`, pass `undefined` as the value of type prop to product create/update services, otherwise pass an object with `{value}` which will be upserted
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
1 parent
bb75a0bc5e
commit
05f921711f
5 files changed
+27
-5
No files matched your search
@@ -761,7 +761,23 @@ const CSVSchema: ProductImportCsvSchema = {
|
||||
{ name: "Product Collection Title", mapTo: "product.collection.title" },
|
||||
{ name: "Product Collection Handle", mapTo: "product.collection.handle" },
|
||||
// PRODUCT-TYPE
|
||||
{ name: "Product Type", mapTo: "product.type.value" },
|
||||
{
|
||||
name: "Product Type",
|
||||
match: /Product Type/,
|
||||
reducer: (
|
||||
builtLine: TParsedProductImportRowData,
|
||||
key,
|
||||
value
|
||||
): TBuiltProductImportLine => {
|
||||
if (typeof value === "undefined" || value === null) {
|
||||
builtLine["product.type"] = undefined
|
||||
} else {
|
||||
builtLine["product.type.value"] = value
|
||||
}
|
||||
|
||||
return builtLine
|
||||
},
|
||||
},
|
||||
// PRODUCT-TAGS
|
||||
{
|
||||
name: "Product Tags",
|
||||
|
||||
@@ -42,7 +42,7 @@ export type InjectedProps = {
|
||||
*/
|
||||
export type TParsedProductImportRowData = Record<
|
||||
string,
|
||||
string | number | object | (string | number | object)[]
|
||||
string | number | object | undefined | (string | number | object)[]
|
||||
>
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user