diff --git a/packages/core/types/src/http/product/admin/payloads.ts b/packages/core/types/src/http/product/admin/payloads.ts index 35739f8179be7..c976542ef600d 100644 --- a/packages/core/types/src/http/product/admin/payloads.ts +++ b/packages/core/types/src/http/product/admin/payloads.ts @@ -69,6 +69,7 @@ export interface AdminCreateProduct { handle?: string status?: ProductStatus type_id?: string + external_id?: string collection_id?: string categories?: { id: string }[] tags?: { id: string }[] @@ -119,6 +120,7 @@ export interface AdminUpdateProduct { handle?: string status?: ProductStatus type_id?: string | null + external_id?: string | null collection_id?: string | null categories?: { id: string }[] tags?: { id: string }[] diff --git a/packages/core/types/src/product/common.ts b/packages/core/types/src/product/common.ts index e419d18b771e7..9c43e90b8a17e 100644 --- a/packages/core/types/src/product/common.ts +++ b/packages/core/types/src/product/common.ts @@ -1453,6 +1453,10 @@ export interface CreateProductDTO { * The associated images to created or updated. */ images?: UpsertProductImageDTO[] + /** + * The id of the product in an external system + */ + external_id?: string /** * The product type id to associate with the product. */ @@ -1569,6 +1573,10 @@ export interface UpdateProductDTO { * The associated images to create or update. */ images?: UpsertProductImageDTO[] + /** + * The id of the product in an external system + */ + external_id?: string | null /** * The product type to associate with the product. */ diff --git a/packages/medusa/src/api/admin/products/validators.ts b/packages/medusa/src/api/admin/products/validators.ts index 2b63ebed97b7d..b516fcd554e30 100644 --- a/packages/medusa/src/api/admin/products/validators.ts +++ b/packages/medusa/src/api/admin/products/validators.ts @@ -218,6 +218,7 @@ export const CreateProduct = z thumbnail: z.string().nullish(), handle: z.string().optional(), status: statusEnum.nullish().default(ProductStatus.DRAFT), + external_id: z.string().nullish(), type_id: z.string().nullish(), collection_id: z.string().nullish(), categories: z.array(IdAssociation).optional(), @@ -254,6 +255,7 @@ export const UpdateProduct = z thumbnail: z.string().nullish(), handle: z.string().nullish(), type_id: z.string().nullish(), + external_id: z.string().nullish(), collection_id: z.string().nullish(), categories: z.array(IdAssociation).optional(), tags: z.array(IdAssociation).optional(),