Files
medusa-store/packages
Avia-Code cc829185f4 feat: added hook for createStockLocationsWorkflow (#11491)
What
This commit introduces the `stockLocationsCreated` hook to the `createStockLocationsWorkflow`.

Why
The hook was missing and necessary to improve the workflow's extensibility.

How
Added the `stockLocationsCreated` hook and updated related logic within the workflow.

Testing

1. Create new medusa project via create-medusa-app
2. Connect this custom branch of medusa to it
3. Create `src/workflows/hooks/stock-locations-created.ts` file with the following content:

```
import { createStockLocationsWorkflow } from "@medusajs/medusa/core-flows"

createStockLocationsWorkflow.hooks.stockLocationsCreated(
  (async ({ stockLocations, additional_data }, { container }) => {
    console.log({stockLocations})
  })
)
```
4. Create new admin account and create there a new stock location
5. The log should be displayed in terminal
2025-03-04 10:53:39 +00:00
..
2025-02-24 11:36:46 +01:00
2025-02-24 11:36:46 +01:00
2025-02-24 11:36:46 +01:00