---
displayed_sidebar: stockLocationReference
slug: /references/stock-location/update
sidebar_label: update
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# update - Stock Location Module Reference

This documentation provides a reference to the `update` method. This belongs to the Stock Location Module.

This method is used to update a stock location.

## Example

```ts
import { 
  initialize as initializeStockLocationModule,
} from "@medusajs/stock-location"

async function updateStockLocation (id:string, name: string) {
  const stockLocationModule = await initializeStockLocationModule({})

  const stockLocation = await stockLocationModule.update(id, {
    name
  })
  
  // do something with the stock location or return it
}
```

## Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The ID of the stock location.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "input",
    "type": "[UpdateStockLocationInput](../../stock_location/types/stock_location.UpdateStockLocationInput.mdx)",
    "description": "The attributes to update in the stock location.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "address",
        "type": "[StockLocationAddressInput](../../stock_location/types/stock_location.StockLocationAddressInput.mdx)",
        "description": "Stock location address object",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "address_1",
            "type": "`string`",
            "description": "Stock location address",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "address_2",
            "type": "`string`",
            "description": "Stock location address' complement",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "city",
            "type": "`string`",
            "description": "Stock location address' city",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "country_code",
            "type": "`string`",
            "description": "Stock location address' country",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "phone",
            "type": "`string`",
            "description": "Stock location address' phone number",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "postal_code",
            "type": "`string`",
            "description": "Stock location address' postal code",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "province",
            "type": "`string`",
            "description": "Stock location address' province",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "address_id",
        "type": "`string`",
        "description": "The Stock location address ID",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "metadata",
        "type": "`Record<string, unknown>`",
        "description": "An optional key-value map with additional details",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "name",
        "type": "`string`",
        "description": "The stock location name",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "context",
    "type": "[SharedContext](../../stock_location/interfaces/stock_location.SharedContext.mdx)",
    "description": "A context used to share resources, such as transaction manager, between the application and the module.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "manager",
        "type": "`EntityManager`",
        "description": "An instance of an entity manager.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "transactionManager",
        "type": "`EntityManager`",
        "description": "An instance of a transaction manager.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

## Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[StockLocationDTO](../../stock_location/types/stock_location.StockLocationDTO.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "The stock location's details.",
    "expandable": false,
    "children": [
      {
        "name": "address",
        "type": "[StockLocationAddressDTO](../../stock_location/types/stock_location.StockLocationAddressDTO.mdx)",
        "description": "The Address of the Stock Location",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "address_1",
            "type": "`string`",
            "description": "Stock location address",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "address_2",
            "type": "`string` \\| `null`",
            "description": "Stock location address' complement",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "city",
            "type": "`string` \\| `null`",
            "description": "Stock location address' city",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "company",
            "type": "`string` \\| `null`",
            "description": "Stock location company' name",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "country_code",
            "type": "`string`",
            "description": "Stock location address' country",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`string` \\| `Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`string` \\| `Date` \\| `null`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The stock location address' ID",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>` \\| `null`",
            "description": "An optional key-value map with additional details",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "phone",
            "type": "`string` \\| `null`",
            "description": "Stock location address' phone number",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "postal_code",
            "type": "`string` \\| `null`",
            "description": "Stock location address' postal code",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "province",
            "type": "`string` \\| `null`",
            "description": "Stock location address' province",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`string` \\| `Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "address_id",
        "type": "`string`",
        "description": "Stock location address' ID",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "created_at",
        "type": "`string` \\| `Date`",
        "description": "The date with timezone at which the resource was created.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "deleted_at",
        "type": "`string` \\| `Date` \\| `null`",
        "description": "The date with timezone at which the resource was deleted.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "id",
        "type": "`string`",
        "description": "The stock location's ID",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "metadata",
        "type": "`Record<string, unknown>` \\| `null`",
        "description": "An optional key-value map with additional details",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "name",
        "type": "`string`",
        "description": "The name of the stock location",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "updated_at",
        "type": "`string` \\| `Date`",
        "description": "The date with timezone at which the resource was updated.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />
