medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.7k stars 2.56k forks source link

Wrong inventory_quantity in search service using @medusajs/inventory #5526

Open andriinuts opened 1 year ago

andriinuts commented 1 year ago

Bug report

Describe the bug

When you are using an inventory module and for example medusa-plugin-meilisearch then in transformer method product -> variants -> inventory_quantity has the wrong value (not from inventory module)

System information

Medusa version (including plugins): "@medusajs/medusa": "^1.17.3", "@medusajs/inventory": "^1.11.2", "@medusajs/stock-location": "^1.11.1", "medusa-plugin-meilisearch": "^2.0.10"

Steps to reproduce the behavior

  1. Setup medusa-plugin-meilisearch and add transformer function
  2. console.log(product.variants[0].inventory_quantity)
  3. See the result n the console

Expected behavior

See the correct value of inventory_quantity from the inventory module

Code snippets

transformer: (product) => { console.log(variant.inventory_quantity); return return { id: product.id, title: product.title, } });

andriinuts commented 11 months ago

up