# Update shipping details

The SKU, weight and size of a physical product. Stock stays as it is. Requires If-Match.

```http
PATCH https://larm.sa/stores/{storeId}/v1/products/{id}/physical
```

Scope: `products:write`

`sku` is up to 64 characters, `weight_grams` up to 1,000,000, and `length_cm`, `width_cm` and `height_cm` up to 1,000. Send `null` to clear a field.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |


## Headers

| Field | Type | Required | Description |
|---|---|---|---|
| `If-Match` | string | yes | ETag from a GET of this same resource projection. |


## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `sku` | string \| null | no |  |
| `weight_grams` | number \| null | no |  |
| `length_cm` | number \| null | no |  |
| `width_cm` | number \| null | no |  |
| `height_cm` | number \| null | no |  |


## Response

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes |  |
| `data.id` | string | no |  |
| `data.name` | string | no |  |
| `data.description` | string | no |  |
| `data.short_desc` | string \| null | no |  |
| `data.image` | string \| null | no |  |
| `data.images` | array<string> | no |  |
| `data.image_alt` | string \| null | no |  |
| `data.category` | string \| null | no | Category name. |
| `data.slug` | string \| null | no |  |
| `data.keywords` | array<string> | no |  |
| `data.supported_devices` | any | no |  |
| `data.seo_title` | string \| null | no |  |
| `data.seo_description` | string \| null | no |  |
| `data.og_image` | string \| null | no |  |
| `data.product_kind` | string | no | One of: `digital`, `service`, `physical`. |
| `data.status` | string | no | One of: `active`, `inactive`. |
| `data.price` | string | no | Price in SAR. |
| `data.old_price` | string \| null | no | Price before discount. |
| `data.price_state` | string | no | required until a price is set; a new product is created inactive with price 0.00. One of: `required`, `ready`. |
| `data.resource_version` | integer | no |  |
| `data.physical` | object \| null | no | Shipping details of a physical product, or null for any other kind. |
| `data.physical.sku` | string \| null | no |  |
| `data.physical.weight_grams` | number \| null | no |  |
| `data.physical.length_cm` | number \| null | no |  |
| `data.physical.width_cm` | number \| null | no |  |
| `data.physical.height_cm` | number \| null | no |  |
| `data.options` | array<object> | no |  |
| `data.options[].name` | string | yes |  |
| `data.options[].values` | array<string> | yes |  |
| `data.variants` | array<object> | no | One row per combination of options. Its quantity is under inventory, with inventory:read. |
| `data.variants[].options` | object | yes | The value of each option, such as {"Size":"M"}. |
| `data.variants[].sku` | string \| null | no |  |
| `data.variants[].enabled` | boolean | no |  |
| `execution` | object | no | Who executed the request: the app, version, installation and store. Field names here are camelCase. |
| `execution.appId` | string (uuid) | no |  |
| `execution.versionId` | string (uuid) | no |  |
| `execution.installationId` | string (uuid) | no |  |
| `execution.storeId` | string (uuid) | no |  |
| `execution.requestId` | string (uuid) | no |  |
| `execution.generation` | integer | no |  |
| `execution.routeEpoch` | integer | no |  |
| `execution.appAuthEpoch` | integer | no |  |
| `execution.grantRevision` | integer | no |  |
| `meta` | object | yes |  |
| `meta.request_id` | string (uuid) | no | The request ID; include it in any support request. |


## Example request

```bash
curl -X PATCH "https://larm.sa/stores/$STORE_ID/v1/products/57/physical" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "If-Match: $ETAG" \
  -H "Content-Type: application/json" \
  -d '{ "sku": "TS-100", "weight_grams": 250, "length_cm": 30, "width_cm": 25, "height_cm": 3 }'
```


## Example response (200)

```json
{
  "data": {
    "id": "57",
    "name": "Cotton T-shirt",
    "description": "A soft cotton T-shirt.",
    "short_desc": "Soft cotton",
    "image": "https://cdn.example/p/57.webp",
    "images": [],
    "image_alt": "Cotton T-shirt",
    "category": "Clothing",
    "slug": "cotton-tshirt",
    "keywords": [],
    "supported_devices": null,
    "seo_title": null,
    "seo_description": null,
    "og_image": null,
    "product_kind": "physical",
    "status": "active",
    "price": "79.00",
    "old_price": null,
    "price_state": "ready",
    "physical": {
      "sku": "TS-100",
      "weight_grams": 250,
      "length_cm": 30,
      "width_cm": 25,
      "height_cm": 3
    },
    "options": [
      {
        "name": "Size",
        "values": [
          "S",
          "M"
        ]
      }
    ],
    "variants": [
      {
        "options": {
          "Size": "S"
        },
        "sku": "TS-100-S",
        "enabled": true
      },
      {
        "options": {
          "Size": "M"
        },
        "sku": "TS-100-M",
        "enabled": true
      }
    ],
    "resource_version": 13
  },
  "execution": {
    "appId": "1f2e3d4c-5b6a-4978-8695-a4b3c2d1e0f9",
    "versionId": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
    "installationId": "c7e4a1f2-6b3d-4e8a-9c05-1d2f3a4b5c6d",
    "storeId": "5b1d7a62-0c4e-4f38-9a51-2e7b3c9d8f10",
    "requestId": "3f0c2b8e-7a51-4c1e-9d0a-5b6f1e2d4c3a",
    "generation": 1,
    "routeEpoch": 4,
    "appAuthEpoch": 1,
    "grantRevision": 2
  },
  "meta": {
    "request_id": "3f0c2b8e-7a51-4c1e-9d0a-5b6f1e2d4c3a"
  }
}
```


## Errors

| HTTP | Code | Meaning |
|---|---|---|
| 428 | `PRECONDITION_REQUIRED` | No If-Match header. |
| 412 | `RESOURCE_CHANGED` | The resource changed after you read it; read it again. |
| 404 | `RESOURCE_NOT_FOUND` | The ID does not exist in this store. |
| 422 | `PHYSICAL_PRODUCT_REQUIRED` | The product is not physical. |
| 422 | `INVALID_PHYSICAL_DETAILS` | A value is outside its limits. |
| 403 | `SCOPE_REQUIRED` | The token does not carry the required scope. |
