Update developer
BetaAPI v2 is in public beta: endpoints, fields and behaviour can change before general availability. See the changelog
const url = 'https://app.stoqapp.com/api/v2/external/preorders/settings/developer';const options = { method: 'PATCH', headers: {'X-Auth-Token': '<X-Auth-Token>', 'Content-Type': 'application/json'}, body: '{"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"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://app.stoqapp.com/api/v2/external/preorders/settings/developer \ --header 'Content-Type: application/json' \ --header 'X-Auth-Token: <X-Auth-Token>' \ --data '{ "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" } }'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 “” 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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
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.
Custom CSS added on every storefront page, shared with back-in-stock. REPLACES the stored CSS; “” or null clears it.
object
A CSS selector in the theme. The product form the Preorder button belongs to.
A CSS selector in the theme. The theme’s add-to-cart button the Preorder button replaces.
A CSS selector in the theme. The element inside the add-to-cart button holding its text.
A CSS selector in the theme. The price the discounted preorder price strikes through.
object
object
A CSS selector in the theme. Where the disclaimer goes on product pages.
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.
object
A CSS selector in the theme. Where the payment options goes on product pages.
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.
object
A CSS selector in the theme. Where the terms goes on product pages.
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.
object
A CSS selector in the theme. Where the badge goes on product pages.
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.
object
A CSS selector in the theme. Where the discounted price goes on product pages.
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.
object
A CSS selector in the theme. Where the countdown timer goes on product pages.
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.
object
A CSS selector in the theme. Where the progress bar goes on product pages.
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.
object
A CSS selector in the theme. The product card form on collection pages.
A CSS selector in the theme. The add-to-cart button on collection page product cards.
A CSS selector in the theme. Where the preorder badge goes on collection page product cards.
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.
object
A CSS selector in the theme. The product card form on home pages.
A CSS selector in the theme. The add-to-cart button on home page product cards.
A CSS selector in the theme. Where the preorder badge goes on home page product cards.
object
A CSS selector in the theme. The product card form on search pages.
A CSS selector in the theme. The add-to-cart button on search page product cards.
A CSS selector in the theme. Where the preorder badge goes on search page product cards.
Example
{ "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" }}Responses
Section titled “Responses”Success — the updated resource.
object
Example generated
{}Saved. Returns the updated section, with also_changed for cascades.
object
Example generated
{}Missing or invalid X-Auth-Token.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "Unauthorized" ]}Invalid fields, keyed by canonical section paths. Nothing was saved.
object
object
Example generated
{ "errors": { "additionalProperty": [ "example" ] }}Rate limited — cost-weighted per token (read 1, write 2; 360 points / 60s). Check Retry-After.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "Rate limit exceeded" ]}Thanks for letting us know.
Still stuck? Ask Quinn or chat with support