Update storefront text
API v2 is in public beta: endpoints and fields can change before general availability. See the changelog
/preorders/settings/storefront_textCosts 2 rate-limit points · Rate limits
Update the shop-wide preorder storefront text: the currency format, the button's out-of-stock and add-to-cart text, and the preorder modal's continue and cancel buttons and error heading. Shared by every preorder offer, not per offer.
Deep partial. Shop-wide: one change applies to every preorder offer. The per-offer Preorder button text and per-state overrides are on the offer's widget and advanced settings. Text fields are written in locale (optional); currency_format is not translated. Returns the section.
Also searched aschange preorder currency formatchange preorder out of stock textchange preorder add to cart textchange preorder modal continue buttonchange preorder modal cancel buttonchange preorder error headingtranslate preorder modal buttons
Headers
Idempotency-KeystringA 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 (422idempotency_key_reused); a retry while the first is still running gets 409idempotency_key_in_progress. Keys are per store. Server errors and rate limits are not kept, so their retry runs.
Request body
currency_formatstringHow preorder prices print on the storefront, such as "{{amount}} {{currency}}". Use {{currency}}, {{currency_symbol}} and a Shopify amount variable ({{amount}}, {{amount_no_decimals}}, {{amount_with_comma_separator}} ...). "" goes back to the theme format. Not translated.
buttonobjectShow 2 child attributesHide child attributes
out_of_stock_textstringButton text once the preorder limit is reached and the product is sold out. Every offer.
add_to_cart_textstringButton text when the product is in stock and not on preorder. Every offer.
modalobjectShow 3 child attributesHide child attributes
continue_button_textstringText on the continue button of the preorder modal. Every offer.
cancel_button_textstringText on the cancel button of the preorder modal. Every offer.
error_headingstringHeading of error messages in the preorder modal. Edited on the preorder translations page. Every offer.
localestringOptional language tag ("fr", "de", "pt-BR"). The text fields are written in that language; omit for the shop's default. currency_format ignores it.
Errors
Missing or invalid X-Auth-Token.
An earlier request with the same Idempotency-Key is still running. Wait, then resend the same request with the same key.
Invalid fields: one details entry per field error, its path the canonical section path. Nothing was saved.
Rate limited: cost-weighted per token (read 1, write 2; 360 points / 60s). Check Retry-After.
Every error has the same shape: see Errors.
curl -X PATCH "https://app.stoqapp.com/api/v2/external/preorders/settings/storefront_text" \
-H "X-Auth-Token: $STOQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"currency_format": "string",
"button": {
"out_of_stock_text": "Preorder now",
"add_to_cart_text": "Preorder now"
},
"modal": {
"continue_button_text": "Preorder now",
"cancel_button_text": "Preorder now",
"error_heading": "string"
},
"locale": "fr"
}'const res = await fetch("https://app.stoqapp.com/api/v2/external/preorders/settings/storefront_text", {
method: "PATCH",
headers: {
"X-Auth-Token": process.env.STOQ_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"currency_format": "string",
"button": {
"out_of_stock_text": "Preorder now",
"add_to_cart_text": "Preorder now"
},
"modal": {
"continue_button_text": "Preorder now",
"cancel_button_text": "Preorder now",
"error_heading": "string"
},
"locale": "fr"
}),
});
const data = await res.json();import os
import requests
res = requests.patch(
"https://app.stoqapp.com/api/v2/external/preorders/settings/storefront_text",
headers={"X-Auth-Token": os.environ["STOQ_API_KEY"]},
json={
"currency_format": "string",
"button": {
"out_of_stock_text": "Preorder now",
"add_to_cart_text": "Preorder now"
},
"modal": {
"continue_button_text": "Preorder now",
"cancel_button_text": "Preorder now",
"error_heading": "string"
},
"locale": "fr"
},
)
data = res.json()require "net/http"
require "json"
uri = URI("https://app.stoqapp.com/api/v2/external/preorders/settings/storefront_text")
req = Net::HTTP::Patch.new(uri, "X-Auth-Token" => ENV["STOQ_API_KEY"], "Content-Type" => "application/json")
req.body = {
currency_format: "string",
button: {
out_of_stock_text: "Preorder now",
add_to_cart_text: "Preorder now"
},
modal: {
continue_button_text: "Preorder now",
cancel_button_text: "Preorder now",
error_heading: "string"
},
locale: "fr"
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body){
"errors": [
"Invalid API key"
],
"code": "auth_invalid",
"details": [
{
"code": "auth_invalid",
"message": "Invalid API key",
"path": null,
"value": null,
"expected": null
}
]
}{
"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
}
]
}{
"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"
}
}
]
}{
"errors": [
"Rate limit exceeded"
],
"code": "rate_limited",
"details": [
{
"code": "rate_limited",
"message": "Rate limit exceeded",
"path": null,
"value": null,
"expected": null
}
]
}