Skip to content

Conversation

@bouazzaayyoub
Copy link
Contributor

@bouazzaayyoub bouazzaayyoub commented Jan 16, 2026

Summary

Enables support for the metadata field on stock location addresses in the Admin API, allowing custom key-value data to be stored on the address entity during creation and updates.

Problem

The StockLocationAddress database model already supports a metadata column, but the Admin API type definitions and validators did not allow this field in request payloads. As a result, any metadata passed when creating or updating a stock location address was stripped at the API layer, preventing users and integrations from persisting custom address-level data (e.g. internal reference IDs, gate codes).

Solution

  • Updated AdminUpsertStockLocationAddress in @medusajs/types to include an optional metadata?: Record<string, unknown> field.
  • Updated the corresponding Admin API Zod validators to allow and validate the metadata field.

This aligns the Admin API with the underlying StockLocationAddress model, which already handles metadata correctly.

How to test

  1. Ensure you have a running Medusa backend.
  2. Send a POST request to /admin/stock-locations with the following payload:
{
  "name": "Metadata Test Location",
  "address": {
    "address_1": "123 Test St",
    "country_code": "US",
    "metadata": {
      "internal_id": "LOC-123",
      "gate_code": "9999"
    }
  }
}

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Aligns Admin API with model by allowing custom key-value `metadata` on stock location addresses.
> 
> - Add `metadata` to `AdminStockLocationAddress` entity type
> - Add optional `metadata` to `AdminUpsertStockLocationAddress` payload type
> - Update admin Zod validator `AdminUpsertStockLocationAddress` to accept `metadata`
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ed81272c148db047fcea996826764cfae30d0e70. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

@bouazzaayyoub bouazzaayyoub requested a review from a team as a code owner January 16, 2026 14:45
@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2026

⚠️ No Changeset found

Latest commit: ed81272

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

vercel bot commented Jan 16, 2026

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

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant