fix: add prices fields to price list query config to include variant_id in response#15021
fix: add prices fields to price list query config to include variant_id in response#15021ashif323 wants to merge 1 commit intomedusajs:developfrom
Conversation
…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 is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for your contribution! After reviewing this PR, we need a few things addressed before we can move forward: Required changes:
Concerns:
|
What
Adds
prices.*fields includingprices.price_set.variant.idtoadminPriceListRemoteQueryFieldsin the price list query config.Why
The
GET /admin/price-listsendpoint was usingadminPriceListRemoteQueryFieldswhich did not include any
prices.*fields. This meant prices were neverfetched from the database, and
buildPriceSetPricesForCorenever receivedprice_set.variant.id— sovariant_idwas always missing from the response.The transformation logic in
buildPriceSetPricesForCorewas already correct— it maps
price_set.variant.idtovariant_id. The issue was purely thatthe prices fields were missing from the query config used by the list endpoint.
Affected file
packages/medusa/src/api/admin/price-lists/query-config.tsRelated
Closes #14995
Note
Low Risk
Low risk field-selection change, but it expands
GET /admin/price-listsqueries/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 (notablyprices.price_set.variant.idand price rule fields) inadminPriceListRemoteQueryFields.This ensures
GET /admin/price-listsfetches 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.