---
title: "Update developer"
description: "Update the shop-wide preorder developer settings: dev mode, the custom CSS, and the theme selectors that place the Preorder button and each preorder element on product pages and on home, collection and search product car"
url: https://docs.stoqapp.com/v2-reference/preorders-settings/update-developer/
api: "API v2 reference"
method: PATCH
path: "/preorders/settings/developer"
---

# Update developer

`PATCH https://app.stoqapp.com/api/v2/external/preorders/settings/developer`

Update the shop-wide preorder developer settings: dev mode, the custom CSS, and the theme selectors that place the Preorder button and each preorder element on product pages and on home, collection and search product cards. Selectors are used only while dev mode is on.

**Note:** Deep partial. null or &quot;&quot; clears a selector so the theme default applies. dev_mode_enabled and css are shared with the back-in-stock widget: changing them here changes them there. Returns the developer section.

## Headers

- `Idempotency-Key` (string): A fresh unique key for every write (a new UUID, say); reuse it only to retry that write. Keys are remembered for 1 hour: the same key and the same request within that hour returns the first result, with `Idempotent-Replayed: true`, without running again; the same key with a different method, path or body is refused (422 `idempotency_key_reused`); a retry while the first is still running gets 409 `idempotency_key_in_progress`. Keys are per store. Server errors and rate limits are not kept, so their retry runs.

## Request body

- `dev_mode_enabled` (boolean): Dev mode: place the Preorder button and preorder elements with the selectors below instead of the automatic placement. Shared with the back-in-stock widget's dev mode.
- `css` (string): Custom CSS added on every storefront page, shared with back-in-stock. REPLACES the stored CSS; &quot;&quot; or null clears it.
- `product_page` (object)
  - `form` (string): A CSS selector in the theme. The product form the Preorder button belongs to.
  - `add_to_cart_button` (string): A CSS selector in the theme. The theme's add-to-cart button the Preorder button replaces.
  - `add_to_cart_text` (string): A CSS selector in the theme. The element inside the add-to-cart button holding its text.
  - `original_price` (string): A CSS selector in the theme. The price the discounted preorder price strikes through.
- `insertion_points` (object)
  - `disclaimer` (object)
    - `selector` (string): A CSS selector in the theme. Where the disclaimer goes on product pages.
    - `insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
  - `payment_options` (object)
    - `selector` (string): A CSS selector in the theme. Where the payment options goes on product pages.
    - `insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
  - `terms` (object)
    - `selector` (string): A CSS selector in the theme. Where the terms goes on product pages.
    - `insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
  - `badge` (object)
    - `selector` (string): A CSS selector in the theme. Where the badge goes on product pages.
    - `insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
  - `discounted_price` (object)
    - `selector` (string): A CSS selector in the theme. Where the discounted price goes on product pages.
    - `insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
  - `countdown_timer` (object)
    - `selector` (string): A CSS selector in the theme. Where the countdown timer goes on product pages.
    - `insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
  - `progress_bar` (object)
    - `selector` (string): A CSS selector in the theme. Where the progress bar goes on product pages.
    - `insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
- `collection` (object)
  - `form` (string): A CSS selector in the theme. The product card form on collection pages.
  - `add_to_cart_button` (string): A CSS selector in the theme. The add-to-cart button on collection page product cards.
  - `badge` (string): A CSS selector in the theme. Where the preorder badge goes on collection page product cards.
  - `badge_insert_type` (string): Where the element goes relative to the selector: beforebegin (before it), afterbegin (inside it, first), beforeend (inside it, last) or afterend (after it). Empty uses the default. One of: `beforebegin`, `afterbegin`, `beforeend`, `afterend`.
- `home` (object)
  - `form` (string): A CSS selector in the theme. The product card form on home pages.
  - `add_to_cart_button` (string): A CSS selector in the theme. The add-to-cart button on home page product cards.
  - `badge` (string): A CSS selector in the theme. Where the preorder badge goes on home page product cards.
- `search` (object)
  - `form` (string): A CSS selector in the theme. The product card form on search pages.
  - `add_to_cart_button` (string): A CSS selector in the theme. The add-to-cart button on search page product cards.
  - `badge` (string): A CSS selector in the theme. Where the preorder badge goes on search page product cards.

Rate limit: this call costs 2 points ([rate limits](https://docs.stoqapp.com/docs/rate-limits/)).

## Example request

```sh
curl -X PATCH "https://app.stoqapp.com/api/v2/external/preorders/settings/developer" \
  -H "X-Auth-Token: $STOQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dev_mode_enabled": true,
    "css": "string",
    "product_page": {
      "form": "string",
      "add_to_cart_button": "string",
      "add_to_cart_text": "Preorder now",
      "original_price": "string"
    },
    "insertion_points": {
      "disclaimer": {
        "selector": "string",
        "insert_type": "beforebegin"
      },
      "payment_options": {
        "selector": "string",
        "insert_type": "beforebegin"
      },
      "terms": {
        "selector": "string",
        "insert_type": "beforebegin"
      },
      "badge": {
        "selector": "string",
        "insert_type": "beforebegin"
      },
      "discounted_price": {
        "selector": "string",
        "insert_type": "beforebegin"
      },
      "countdown_timer": {
        "selector": "string",
        "insert_type": "beforebegin"
      },
      "progress_bar": {
        "selector": "string",
        "insert_type": "beforebegin"
      }
    },
    "collection": {
      "form": "string",
      "add_to_cart_button": "string",
      "badge": "string",
      "badge_insert_type": "beforebegin"
    },
    "home": {
      "form": "string",
      "add_to_cart_button": "string",
      "badge": "string"
    },
    "search": {
      "form": "string",
      "add_to_cart_button": "string",
      "badge": "string"
    }
  }'
```

## 200

Success: the updated resource.

## 202

Saved. Returns the updated section, with also_changed for cascades.

## 401

Missing or invalid `X-Auth-Token`.

```json
{
  "errors": [
    "Invalid API key"
  ],
  "code": "auth_invalid",
  "details": [
    {
      "code": "auth_invalid",
      "message": "Invalid API key",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 409

An earlier request with the same Idempotency-Key is still running. Wait, then resend the same request with the same key.

```json
{
  "errors": [
    "A request with this Idempotency-Key is still running"
  ],
  "code": "idempotency_key_in_progress",
  "details": [
    {
      "code": "idempotency_key_in_progress",
      "message": "A request with this Idempotency-Key is still running",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 422

Invalid fields: one `details` entry per field error, its `path` the canonical section path. Nothing was saved.

```json
{
  "errors": [
    "widget.button.text_color must be a hex color"
  ],
  "code": "invalid_params",
  "details": [
    {
      "code": "invalid_params",
      "message": "must be a hex color",
      "path": "widget.button.text_color",
      "value": "blue",
      "expected": {
        "type": "string"
      }
    }
  ]
}
```

## 429

Rate limited: cost-weighted per token (read 1, write 2; 360 points / 60s). Check `Retry-After`.

```json
{
  "errors": [
    "Rate limit exceeded"
  ],
  "code": "rate_limited",
  "details": [
    {
      "code": "rate_limited",
      "message": "Rate limit exceeded",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

