-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(medusa): update create fulfillment flow #3172
Conversation
🦋 Changeset detectedLatest commit: a8ebac2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
34f3239
to
8ab6c79
Compare
8ab6c79
to
f13fd13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
non-blocking: We could add an integration test to this flow
}) | ||
invItemId = invItem.id | ||
|
||
await prodVarInventoryService.attachInventoryItem(variantId, invItem.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Deos that mean that the SKU that is used to create the inventory item can be different than the variant SKU? are they meaning different thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you will still have access to all the variants stock related fields, however they wont impact behavior if you use the inventory module.
packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts
Outdated
Show resolved
Hide resolved
packages/medusa/src/api/routes/admin/orders/create-fulfillment.ts
Outdated
Show resolved
Hide resolved
@pKorsholm Please resolve conflicts when time allows for it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Pending @adrien2p's approval :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one minore todo if needed
if (isDefined(data.sales_channel)) { | ||
let sc | ||
|
||
if (isString(data.sales_channel)) { | ||
sc = await manager.findOne(SalesChannel, { | ||
where: { id: data.sales_channel }, | ||
}) | ||
} | ||
|
||
if (!sc) { | ||
sc = await simpleSalesChannelFactory( | ||
connection, | ||
isString(data.sales_channel) | ||
? { id: data.sales_channel } | ||
: data.sales_channel | ||
) | ||
} | ||
|
||
sc_id = sc.id | ||
} | ||
|
||
if (sc_id) { | ||
toCreate.sales_channel_id = sc_id | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: if data.sales_channel
is defined but is not a string, we don't do anything. I am missing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if data.sales_channel
is defined but not a string we pass it into the sales channel factory on line 120
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL, I did not see the not in the if constraint. I need to clean my glasses
a436b01
to
23aed0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* update create fulfillment flow * move transaction service creation close to where it's used * integration tests * fix feedback * use transformBody * add changeset
What
Why