Skip to content

Update developer settings

API v2 is in public beta: endpoints and fields can change before general availability. See the changelog

PATCH/preorders/settings/developer

Costs 2 rate-limit points · Rate limits

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.

Deep partial. null or "" 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.

Also searched aschange preorder selectorsset preorder button selectorfix preorder button placement

Headers

  • Idempotency-Keystring

    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_enabledboolean

    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.

  • cssstring

    Custom CSS added on every storefront page, shared with back-in-stock. REPLACES the stored CSS; "" or null clears it.

  • product_pageobject

    Theme selectors for the product form and add-to-cart button on product pages.

    Show 4 child attributesHide child attributes
    • formstring

      A CSS selector in the theme. The product form the Preorder button belongs to.

    • add_to_cart_buttonstring

      A CSS selector in the theme. The theme's add-to-cart button the Preorder button replaces.

    • add_to_cart_textstring

      A CSS selector in the theme. The element inside the add-to-cart button holding its text.

    • original_pricestring

      A CSS selector in the theme. The price the discounted preorder price strikes through.

  • insertion_pointsobject

    Where each preorder element goes on product pages, as a selector and position.

    Show 7 child attributesHide child attributes
    • disclaimerobject
      Show 2 child attributesHide child attributes
      • selectorstring

        A CSS selector in the theme. Where the disclaimer goes on product pages.

      • insert_typestring

        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 beforebeginafterbeginbeforeendafterend
    • payment_optionsobject
      Show 2 child attributesHide child attributes
      • selectorstring

        A CSS selector in the theme. Where the payment options goes on product pages.

      • insert_typestring

        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 beforebeginafterbeginbeforeendafterend
    • termsobject
      Show 2 child attributesHide child attributes
      • selectorstring

        A CSS selector in the theme. Where the terms goes on product pages.

      • insert_typestring

        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 beforebeginafterbeginbeforeendafterend
    • badgeobject
      Show 2 child attributesHide child attributes
      • selectorstring

        A CSS selector in the theme. Where the badge goes on product pages.

      • insert_typestring

        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 beforebeginafterbeginbeforeendafterend
    • discounted_priceobject
      Show 2 child attributesHide child attributes
      • selectorstring

        A CSS selector in the theme. Where the discounted price goes on product pages.

      • insert_typestring

        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 beforebeginafterbeginbeforeendafterend
    • countdown_timerobject
      Show 2 child attributesHide child attributes
      • selectorstring

        A CSS selector in the theme. Where the countdown timer goes on product pages.

      • insert_typestring

        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 beforebeginafterbeginbeforeendafterend
    • progress_barobject
      Show 2 child attributesHide child attributes
      • selectorstring

        A CSS selector in the theme. Where the progress bar goes on product pages.

      • insert_typestring

        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 beforebeginafterbeginbeforeendafterend
  • collectionobject

    Theme selectors for product cards on collection pages.

    Show 4 child attributesHide child attributes
    • formstring

      A CSS selector in the theme. The product card form on collection pages.

    • add_to_cart_buttonstring

      A CSS selector in the theme. The add-to-cart button on collection page product cards.

    • badgestring

      A CSS selector in the theme. Where the preorder badge goes on collection page product cards.

    • badge_insert_typestring

      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 beforebeginafterbeginbeforeendafterend
  • homeobject

    Theme selectors for product cards on the home page.

    Show 3 child attributesHide child attributes
    • formstring

      A CSS selector in the theme. The product card form on home pages.

    • add_to_cart_buttonstring

      A CSS selector in the theme. The add-to-cart button on home page product cards.

    • badgestring

      A CSS selector in the theme. Where the preorder badge goes on home page product cards.

  • searchobject

    Theme selectors for product cards on search results pages.

    Show 3 child attributesHide child attributes
    • formstring

      A CSS selector in the theme. The product card form on search pages.

    • add_to_cart_buttonstring

      A CSS selector in the theme. The add-to-cart button on search page product cards.

    • badgestring

      A CSS selector in the theme. Where the preorder badge goes on search page product cards.

Returns

  • dev_mode_enabledboolean
    Example: true
  • cssstring, nullable
    Example: .stoq-preorder-button { border-radius: 24px; }
  • product_pageobject
    Show 4 child attributesHide child attributes
    • formstring
      Example: form[action*="/cart/add"]
    • add_to_cart_buttonnull
      Example: button[name="add"]
    • add_to_cart_textstring
      Example: span
    • original_pricenull
      Example: .price__regular .price-item
  • insertion_pointsobject
    Show 7 child attributesHide child attributes
    • disclaimerobject
      Show 2 child attributesHide child attributes
      • selectornull
        Example: .product-form__buttons
      • insert_typestring
        Example: afterend
    • payment_optionsobject
      Show 2 child attributesHide child attributes
      • selectornull
      • insert_typestring
        Example: afterend
    • termsobject
      Show 2 child attributesHide child attributes
      • selectorstring, nullable
      • insert_typestring
        Example: afterend
    • badgeobject
      Show 2 child attributesHide child attributes
      • selectornull
      • insert_typestring
        Example: afterend
    • discounted_priceobject
      Show 2 child attributesHide child attributes
      • selectornull
      • insert_typestring
        Example: afterend
    • countdown_timerobject
      Show 2 child attributesHide child attributes
      • selectornull
      • insert_typestring
        Example: afterend
    • progress_barobject
      Show 2 child attributesHide child attributes
      • selectornull
      • insert_typestring
        Example: beforebegin
  • collectionobject
    Show 4 child attributesHide child attributes
    • formstring
      Example: form[action*="/cart/add"]
    • add_to_cart_buttonstring
      Example: form[action*="/cart/add"] button
    • badgenull
    • badge_insert_typestring
      Example: afterend
  • homeobject
    Show 3 child attributesHide child attributes
    • formstring
      Example: form[action*="/cart/add"]
    • add_to_cart_buttonstring
      Example: form[action*="/cart/add"] button
    • badgestring, nullable
  • searchobject
    Show 3 child attributesHide child attributes
    • formstring
      Example: form[action*="/cart/add"]
    • add_to_cart_buttonstring
      Example: form[action*="/cart/add"] button
    • badgenull

Errors

409
idempotency_key_in_progress

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

422
invalid_params

One or more fields failed the action's schema.

429
shopify_rate_limited

Shopify throttled the store's Admin API, so the call was not made.

Any request can also fail with auth_invalid (401) or rate_limited (429).

Every error has the same shape: see Errors and the list of error codes.

PATCH/preorders/settings/developer
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,
    "product_page": {
      "add_to_cart_button": "button[name=\"add\"]"
    },
    "insertion_points": {
      "disclaimer": {
        "selector": ".product-form__buttons",
        "insert_type": "afterend"
      }
    }
  }'
Response
{
  "dev_mode_enabled": true,
  "css": ".stoq-preorder-button { border-radius: 24px; }",
  "product_page": {
    "form": "form[action*=\"/cart/add\"]",
    "add_to_cart_button": "button[name=\"add\"]",
    "add_to_cart_text": "span",
    "original_price": ".price__regular .price-item"
  },
  "insertion_points": {
    "disclaimer": {
      "selector": ".product-form__buttons",
      "insert_type": "afterend"
    },
    "payment_options": {
      "selector": null,
      "insert_type": "afterend"
    },
    "terms": {
      "selector": null,
      "insert_type": "afterend"
    },
    "badge": {
      "selector": null,
      "insert_type": "afterend"
    },
    "discounted_price": {
      "selector": null,
      "insert_type": "afterend"
    },
    "countdown_timer": {
      "selector": null,
      "insert_type": "afterend"
    },
    "progress_bar": {
      "selector": null,
      "insert_type": "beforebegin"
    }
  },
  "collection": {
    "form": "form[action*=\"/cart/add\"]",
    "add_to_cart_button": "form[action*=\"/cart/add\"] button",
    "badge": null,
    "badge_insert_type": "afterend"
  },
  "home": {
    "form": "form[action*=\"/cart/add\"]",
    "add_to_cart_button": "form[action*=\"/cart/add\"] button",
    "badge": null
  },
  "search": {
    "form": "form[action*=\"/cart/add\"]",
    "add_to_cart_button": "form[action*=\"/cart/add\"] button",
    "badge": null
  }
}