From f4c9a4698f6d48bbcfd18aed3312275f496d99ff Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 22 Dec 2022 12:12:21 +0200 Subject: [PATCH 1/2] docs: added a note about running migrations (#2875) * docs: added a note about running migrations * docs: fixed link --- .../content/advanced/backend/upgrade-guides/1-7-0.md | 12 ++++++++++++ .../advanced/storefront/implement-claim-order.mdx | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/content/advanced/backend/upgrade-guides/1-7-0.md b/docs/content/advanced/backend/upgrade-guides/1-7-0.md index 9c706d1c4d..497bec85b1 100644 --- a/docs/content/advanced/backend/upgrade-guides/1-7-0.md +++ b/docs/content/advanced/backend/upgrade-guides/1-7-0.md @@ -10,8 +10,20 @@ Version `1.7.0` of Medusa introduces a breaking change in the [CustomerService]( In this new version, the method [`retrieveByEmail` in the Customer Service](../../../references/services/classes/CustomerService.md#retrievebyemail) has been deprecated in favor of other methods. Read the actions required below to learn which methods to use instead. +In addition, after introducing the Claim Order feature, this version of Medusa introduces changes in the database that allows two customers having the same email based on the value of the `has_account` field. This change requires running migrations after the update. + ## Actions Required +### Run Migrations + +Run the following command to run migrations: + +```bash +medusa migrations run +``` + +### Change Used Methods + Instead of using `customerService.retrieveByEmail`, you should now use the methods `customerService.retrieveRegisteredByEmail` or `customerService.retrieveUnRegisteredByEmail`. The `customerService.retrieveRegisteredByEmail` method allows you to retrieve a registered customer by email: diff --git a/docs/content/advanced/storefront/implement-claim-order.mdx b/docs/content/advanced/storefront/implement-claim-order.mdx index 0c223d556c..00ba56203a 100644 --- a/docs/content/advanced/storefront/implement-claim-order.mdx +++ b/docs/content/advanced/storefront/implement-claim-order.mdx @@ -5,11 +5,17 @@ import TabItem from '@theme/TabItem'; In this document, you’ll learn how to implement the claim order flow in a storefront to allow customers to claim their orders. +:::note + +This flow was added starting from Medusa v1.7. You can learn more about upgrading in the [upgrade guide](../backend/upgrade-guides/1-7-0.md). + +::: + ## Flow Overview When a guest customer places an order, their order is not associated with any customer. The order is only associated with an email that the guest customer provides during checkout. -This email must be an email that isn’t used with an existing account. Also, this email cannot be used later on to create a new account. It can, however, be used to create another order as a guest customer. +This email must be an email that isn’t used with an existing account. It can, however, be used to create another order as a guest customer. After this customer registers with a different email and logs in, they can claim their order by providing the order’s ID. An email will then be sent to the email address associated with the order. From c78e78de284e0a406615d82e3dfbf98eaf4ecaac Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 22 Dec 2022 15:30:18 +0200 Subject: [PATCH 2/2] docs: fixed typo in upgrade guide v1.7 (#2879) --- docs/content/advanced/backend/upgrade-guides/1-7-0.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/content/advanced/backend/upgrade-guides/1-7-0.md b/docs/content/advanced/backend/upgrade-guides/1-7-0.md index 497bec85b1..a5eebd7e95 100644 --- a/docs/content/advanced/backend/upgrade-guides/1-7-0.md +++ b/docs/content/advanced/backend/upgrade-guides/1-7-0.md @@ -24,23 +24,23 @@ medusa migrations run ### Change Used Methods -Instead of using `customerService.retrieveByEmail`, you should now use the methods `customerService.retrieveRegisteredByEmail` or `customerService.retrieveUnRegisteredByEmail`. +Instead of using `customerService.retrieveByEmail`, you should now use the methods `customerService.retrieveRegisteredByEmail` or `customerService.retrieveUnregisteredByEmail`. The `customerService.retrieveRegisteredByEmail` method allows you to retrieve a registered customer by email: -```tsx +```ts customerService.retrieveRegisteredByEmail("example@gmail.com"); ``` On the other hand, the `retrieveUnregisteredByEmail` method allows to retrieve guest customers by email: ```jsx -customerService.retrieveUnRegisteredByEmail("example@gmail.com"); +customerService.retrieveUnregisteredByEmail("example@gmail.com"); ``` To retrieve a customer by email regardless of whether they are registered or not, you can use the `customerService.list` method instead: -```tsx +```ts customerService.list({ email: "example@gmail.com" })