# deletePriceListsWorkflow - Medusa Core Workflows Reference

This documentation provides a reference to the `deletePriceListsWorkflow`. It belongs to the `@medusajs/medusa/core-flows` package.

This workflow deletes one or more price lists. It's used by the
[Delete Price List Admin API Route](https://docs.medusajs.com/api/admin#price-lists_deletepricelistsid).

You can use this workflow within your customizations or your own custom workflows, allowing you to
delete price lists in your custom flows.

[Source code](https://github.com/medusajs/medusa/blob/3c2ae85bf15ddcf5c29c2a2a8a79e3fe355717c5/packages/core/core-flows/src/price-list/workflows/delete-price-lists.ts#L36)

## Examples

### API Route

```ts title="src/api/workflow/route.ts"
import type {
  MedusaRequest,
  MedusaResponse,
} from "@medusajs/framework/http"
import { deletePriceListsWorkflow } from "@medusajs/medusa/core-flows"

export async function POST(
  req: MedusaRequest,
  res: MedusaResponse
) {
  const { result } = await deletePriceListsWorkflow(req.scope)
    .run({
      input: {
        ids: ["plist_123"]
      }
    })

  res.send(result)
}
```

### Subscriber

```ts title="src/subscribers/order-placed.ts"
import {
  type SubscriberConfig,
  type SubscriberArgs,
} from "@medusajs/framework"
import { deletePriceListsWorkflow } from "@medusajs/medusa/core-flows"

export default async function handleOrderPlaced({
  event: { data },
  container,
}: SubscriberArgs < { id: string } > ) {
  const { result } = await deletePriceListsWorkflow(container)
    .run({
      input: {
        ids: ["plist_123"]
      }
    })

  console.log(result)
}

export const config: SubscriberConfig = {
  event: "order.placed",
}
```

### Scheduled Job

```ts title="src/jobs/message-daily.ts"
import { MedusaContainer } from "@medusajs/framework/types"
import { deletePriceListsWorkflow } from "@medusajs/medusa/core-flows"

export default async function myCustomJob(
  container: MedusaContainer
) {
  const { result } = await deletePriceListsWorkflow(container)
    .run({
      input: {
        ids: ["plist_123"]
      }
    })

  console.log(result)
}

export const config = {
  name: "run-once-a-day",
  schedule: "0 0 * * *",
}
```

### Another Workflow

```ts title="src/workflows/my-workflow.ts"
import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deletePriceListsWorkflow } from "@medusajs/medusa/core-flows"

const myWorkflow = createWorkflow(
  "my-workflow",
  () => {
    const result = deletePriceListsWorkflow
      .runAsStep({
        input: {
          ids: ["plist_123"]
        }
      })
  }
)
```

## Steps

- [deletePriceListsStep](../../../Steps_Price_List/functions/core_flows.Price_List.Steps_Price_List.deletePriceListsStep/page.mdx): This step deletes one or more price lists.
- [removeRemoteLinkStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.removeRemoteLinkStep/page.mdx): This step deletes linked records of a record if cascade deletion is enabled.

  Learn more in the \[Link documentation]\(https://docs.medusajs.com/learn/fundamentals/module-links/link#cascade-delete-linked-records)

## Input

- DeletePriceListsWorkflowInput: (\[DeletePriceListsWorkflowInput]\(../../../../types/core\_flows.DeletePriceListsWorkflowInput/page.mdx)) The data to delete price lists.

  - ids: (\`string\`\[]) The IDs of the price lists to delete.


---

The best way to deploy Medusa is through Medusa Cloud where you get autoscaling production infrastructure fine tuned for Medusa. Create an account by signing up at cloud.medusajs.com/signup.
