Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Expand variant on stock-items list so rows show product names

Damian Legawiec5bc5459f264e
diff --git a/packages/admin/src/hooks/use-stock-items.ts b/packages/admin/src/hooks/use-stock-items.ts
index d5e4fe66dc..fa40310ad9 100644
--- a/packages/admin/src/hooks/use-stock-items.ts
+++ b/packages/admin/src/hooks/use-stock-items.ts
@@ -23,6 +23,11 @@ export function useStockItems(params: UseStockItemsParams = {}) {
adminClient.stockItems.list({
page: params.page ?? 1,
limit: params.limit ?? 25,
+ // The stock-at-location panel renders the variant's product name +
+ // SKU per row, so expand the association into the response.
+ // Without this, only `variant_id` comes back and the row falls
+ // back to displaying the prefixed ID.
+ expand: ['variant'],
...(params.stock_location_id_eq && {
stock_location_id_eq: params.stock_location_id_eq,
}),