Price List Data Fetcher (price-lists/helpers.ts)

medusa · packages/medusa/src/api/admin/price-lists/helpers.ts · typescript · MIT
database, payments, integration, tag:medusa

Fetches and transforms price list data from the Medusa backend. Use this to retrieve and format pricing rules for administrative operations.

// Source: https://github.com/medusajs/medusa | License: MIT | Copyright 2021 Medusajs
// Provided via justclaw.it.com; keep this notice with the code.
import { MedusaContainer } from "@medusajs/framework/types"
import {
  buildPriceListRules,
  buildPriceSetPricesForCore,
  ContainerRegistrationKeys,
  isPresent,
  MedusaError,
  remoteQueryObjectFromString,
} from "@medusajs/framework/utils"

export const fetchPriceList = async (
  id: string,
  scope: MedusaContainer,
  fields: string[]
) => {
  const remoteQuery = scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)

  const queryObject = remoteQueryObjectFromString({
    entryPoint: "price_lists",
    variables: {
      filters: { id },
    },
    fields,
  })

  const [priceList] = await remoteQuery(queryObject)

  if (!isPresent(pr

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key