Skip to content

fix: add prices fields to price list query config to include variant_id in response#15021

Open
ashif323 wants to merge 1 commit intomedusajs:developfrom
ashif323:fix/price-list-missing-variant-id
Open

fix: add prices fields to price list query config to include variant_id in response#15021
ashif323 wants to merge 1 commit intomedusajs:developfrom
ashif323:fix/price-list-missing-variant-id

Conversation

@ashif323
Copy link
Copy Markdown

@ashif323 ashif323 commented Apr 7, 2026

What

Adds prices.* fields including prices.price_set.variant.id to
adminPriceListRemoteQueryFields in the price list query config.

Why

The GET /admin/price-lists endpoint was using adminPriceListRemoteQueryFields
which did not include any prices.* fields. This meant prices were never
fetched from the database, and buildPriceSetPricesForCore never received
price_set.variant.id — so variant_id was always missing from the response.

The transformation logic in buildPriceSetPricesForCore was already correct
— it maps price_set.variant.id to variant_id. The issue was purely that
the prices fields were missing from the query config used by the list endpoint.

Affected file

packages/medusa/src/api/admin/price-lists/query-config.ts

Related

Closes #14995


Note

Low Risk
Low risk field-selection change, but it expands GET /admin/price-lists queries/responses to include nested price data which could affect response size/performance.

Overview
Updates the admin price list query config to include nested prices.* fields (notably prices.price_set.variant.id and price rule fields) in adminPriceListRemoteQueryFields.

This ensures GET /admin/price-lists fetches price data needed for downstream transformations so responses can include the associated variant id.

Reviewed by Cursor Bugbot for commit b49f6a2. Bugbot is set up for automated code reviews on this repo. Configure here.

…id in response

The GET /admin/price-lists endpoint was using adminPriceListRemoteQueryFields
which did not include any prices.* fields. This meant prices were never
fetched, and buildPriceSetPricesForCore never received price_set.variant.id,
so variant_id was always missing from the response.

Fix: add prices fields including prices.price_set.variant.id to
adminPriceListRemoteQueryFields so variant_id is correctly mapped
in the list endpoint response.

Fixes medusajs#14995
@ashif323 ashif323 requested a review from a team as a code owner April 7, 2026 05:15
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 7, 2026

⚠️ No Changeset found

Latest commit: b49f6a2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

@ashif323 is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

@medusa-os-bot
Copy link
Copy Markdown

medusa-os-bot bot commented Apr 9, 2026

Thank you for your contribution!

After reviewing this PR, we need a few things addressed before we can move forward:

Required changes:

  • Complete the PR description — the How and Testing sections from the pull request template are missing (they appear as ## Affected file and no testing section). Please describe how the changes were implemented and how a reviewer can verify the fix.
  • Add a changeset by running yarn changeset and selecting @medusajs/medusa as a patch bump. The changeset message should follow the format: fix(@medusajs/medusa): add prices fields to price list query config to include variant_id in response.
  • Add or update integration tests in integration-tests/http/__tests__/price-list/admin/price-list.spec.ts to verify that variant_id is present in the prices array when calling GET /admin/price-lists. Changes to packages/medusa/src/api/ require corresponding integration test coverage.

Concerns:

  • Expanding adminPriceListRemoteQueryFields with prices.* fields will increase the payload and query cost for all endpoints using retrivePriceListQueryConfig / listPriceListQueryConfig (list, retrieve, update, and delete price list endpoints). This is likely acceptable to fix the bug, but the team should be aware of the broader query expansion beyond just the list endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Variant Id not present in prices when fetching an price list

1 participant