medusa icon indicating copy to clipboard operation
medusa copied to clipboard

prices region in product list

Open maxpanakov opened this issue 3 years ago • 2 comments

Bug report

Describe the bug

Hey, im trying to get region information in store/products?expand=variants,variants.prices,variants.prices.region, but response only has prices in variants, also if i'm sending this: expand=variants, i still will get prices in the response

System information

Medusa version (including plugins):1.38 Node.js version:14 Database:postgres Operating system: Browser (if relevant):

Steps to reproduce the behavior

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen

Screenshots

If applicable, add screenshots to help explain your problem

Code snippets

If applicable, add code samples to help explain your problem

Additional context

Add any other context about the problem here

maxpanakov avatar Sep 13 '22 11:09 maxpanakov

Thanks for reporting - this happens because we are collecting the product prices separately from the products as seen here: https://github.com/medusajs/medusa/blob/master/packages/medusa/src/api/routes/store/products/list-products.ts#L223

The PricingService doesn't take the expand param into account so there is no option to collect more data when the prices are fetched this way through.

We can look into expanding the PricingService to send this information back as well!

Out of curiosity, what will you use the data for?

srindom avatar Sep 13 '22 12:09 srindom

We wanted to get information to display the price without sending a request to create a cart or to get a list of regions. But that's not a problem.

Thanks for the answer

maxpanakov avatar Sep 14 '22 05:09 maxpanakov