diff --git a/integration-tests/http/__tests__/customer/store/customer.spec.ts b/integration-tests/http/__tests__/customer/store/customer.spec.ts index 9f9087204f..4fade4635f 100644 --- a/integration-tests/http/__tests__/customer/store/customer.spec.ts +++ b/integration-tests/http/__tests__/customer/store/customer.spec.ts @@ -53,6 +53,12 @@ medusaIntegrationTestRunner({ email: "newcustomer@medusa.js", first_name: "John", last_name: "Doe", + metadata: { + loyalty_level: "gold", + preferences: { + newsletter: true, + }, + }, }, { headers: { @@ -69,6 +75,12 @@ medusaIntegrationTestRunner({ first_name: "John", last_name: "Doe", has_account: true, + metadata: { + loyalty_level: "gold", + preferences: { + newsletter: true, + }, + }, }), }) }) diff --git a/packages/medusa/src/api/store/customers/validators.ts b/packages/medusa/src/api/store/customers/validators.ts index 79b69bdae1..0c07179b89 100644 --- a/packages/medusa/src/api/store/customers/validators.ts +++ b/packages/medusa/src/api/store/customers/validators.ts @@ -10,6 +10,7 @@ export const StoreCreateCustomer = z.object({ first_name: z.string().nullish(), last_name: z.string().nullish(), phone: z.string().nullish(), + metadata: z.record(z.unknown()).nullish(), }) export const StoreUpdateCustomer = z.object({ @@ -17,6 +18,7 @@ export const StoreUpdateCustomer = z.object({ first_name: z.string().nullish(), last_name: z.string().nullish(), phone: z.string().nullish(), + metadata: z.record(z.unknown()).nullish(), }) export const StoreGetCustomerAddressParams = createSelectParams()