跳到內容
安裝應用程式
繁體中文

[GET] 設定

AI 概覽

說明回傳商店應用程式設定的唯讀端點,包括時區、日期格式、店面文字,以及預購和即將推出的顯示選項。

  • 呼叫 GET /shop-api/settings,不需參數;速率限制為 throttle:60,1。
  • 設定只能透過 API 讀取;請在應用程式管理後台中變更。
  • timezone、date_format 和 translation 只需任何有效的權杖;preorder 和 coming_soon 群組需要其讀取範圍,否則會被省略。
  • use_selling_plan 顯示商店使用的模式:true 表示 Shopify 銷售方案模式,false 表示舊版模式。
  • translation.default 一律存在;其他語言可能只包含已翻譯的鍵值,因此請退回使用 default。

摘要由 AI 產生,可能有誤,請以下方完整指南為準。

[GET] 設定

* 驗證

必要 Authorization

限制 throttle:60,1

端點 GET - /shop-api/settings

唯讀。商店設定只能透過 Shop API 讀取;若要變更,請在應用程式管理介面中進行。

標頭

標頭 必填 說明
Authorization 是 商店公開 API 金鑰 Bearer token
Content-Type 是 application/json

範圍

任何有效的 API 權杖都可呼叫此端點。回傳哪些群組取決於權杖的範圍;權杖無法讀取的群組會從回應中省略。

群組 所需範圍
timezone, date_format, translation 無(任何有效權杖)
preorder read_preorders(或 write_preorders)
coming_soon read_coming_soon(或 write_coming_soon)

1. 請求 Payload

無參數,無 JSON 內容。

範例

GET /shop-api/settings
Authorization: Bearer token ************

2. 成功回應 200

具有 read_preorders 與 read_coming_soon 的權杖(此範例中的 translation 已截斷):

{
"success": true,
"data": {
"timezone": "America/New_York",
"date_format": "MMM DD, YYYY",
"translation": {
"default": {
"preorderText": "Pre Order",
"messageAboveText": "Don't miss out - Grab yours now before we sell out again!",
"messageBellowText": "We will fulfill the item as soon as it becomes available",
"preorderBadge": "Pre Order",
"preorderLabel": "Pre-order",
"comingSoonAddToCartText": "Coming soon",
"partialPaymentLabel": "Payment option",
"partialPaymentReleased": "You will be charged the remaining balance when the product is released on {{ released }}"
},
"fr": {
"preorderText": "Précommander",
"preorderBadge": "Précommande"
}
},
"preorder": {
"use_selling_plan": true,
"hide_buy_now_button": true,
"required_continue_selling": false,
"show_preorder_badge": true,
"show_preorder_label": true,
"show_payment_option_on_collection": true,
"show_messages_on_collection": false
},
"coming_soon": {
"show_coming_soon_badge": false,
"show_messages_on_collection": false
}
}
}

3. 回應鍵值與欄位

最上層

鍵值 類型 說明
success boolean 成功時為 true
data object 商店設定物件

data 設定物件

欄位 類型 說明
timezone string 商店的 IANA 時區,例如 America/New_York。透過 Shop API 建立的優惠會以此時區處理 start_date / end_date
date_format string 應用程式中設定的日期顯示格式,使用 Moment.js 風格的標記,例如 MMM DD, YYYY、DD/MM/YYYY。預設為 MMM DD, YYYY
translation object 各語系的店面文字。請參閱下方的 translation
preorder object 預購設定。僅限具有 read_preorders 範圍時
coming_soon object 即將上市設定。僅限具有 read_coming_soon 範圍時

preorder

欄位 類型 說明
use_selling_plan boolean 商店的預購模式:true = Shopify 銷售方案模式,false = 舊版模式
hide_buy_now_button boolean 隱藏預購商品的「立即購買」按鈕(商品頁面與快速檢視視窗)
required_continue_selling boolean 僅在商品啟用「缺貨時繼續銷售」時才顯示預購
show_preorder_badge boolean 在商品清單中顯示預購徽章。若目前方案不包含徽章,則一律為 false
show_preorder_label boolean 顯示預購標籤
show_payment_option_on_collection boolean 在商品系列頁面顯示付款選項(全額付款 / 部分付款)
show_messages_on_collection boolean 在商品系列頁面顯示促銷訊息與出貨備註(按鈕上方 / 下方的訊息)

coming_soon

欄位 類型 說明
show_coming_soon_badge boolean 在商品清單中顯示即將上市徽章
show_messages_on_collection boolean 在商品系列頁面顯示按鈕上方 / 下方的即將上市訊息

translation

鍵值 類型 說明
default object 商店預設語言的文字。一律存在;商店從未自訂過的鍵值會以應用程式預設值填補
<locale> object 其他語言的文字,以語系代碼為鍵值(例如 fr)。可能僅包含已翻譯的鍵值 — 缺少的鍵值請退回使用 default

文字可能包含 HTML 與預留位置,例如 :stock、:max、{{product.title}}、{{variant.title}}、{{ released }}。

翻譯鍵值(日後可能新增更多鍵值):

群組 鍵值
預購按鈕與訊息 preorderText, messageAboveText, messageBellowText, naMessageText, soldoutText, comingSoonText, preorderLimitMessage, outOfStockMessage, preorderLabel
倒數計時 labelCountdownStart, labelCountdownEnd, labelCountdownComingsoon, labelCountdownDays, labelCountdownHours, labelCountdownMinutes, labelCountdownSeconds
即將上市 comingSoonAddToCartText, messageComingSoonAboveText, messageComingSoonBellowText
徽章 preorderBadge, comingSoonPreorderBadge, comingSoonAtcBadge
付款 partialPaymentLabel, partialPaymentOptionFull, partialPaymentOptionPart, preorderPrice, partialPaymentTitle, partialPaymentReleased, partialPaymentSaveLavel
購物車 preorderedItemlabel, preorderContactLink, cartWarningTitle, cartWarningContent, cartWarningCheckboxLabel, cartWarningLimitMessage, cartWarningEndLimitMessage, cartWarningAlertMessage
到貨通知 bisTextButton, bisTitleForm, bisHeaderContent, bisPlaceHolderEmail, bisSubscribeTextButton, bisFooterContent, bisSubscribeSuccess, bisSubscribeFail, bisSubscribeRegistered, bisSubscribeRequired, bisPhoneRegistered, bisEmailAlertTitle, bisSmsAlertTitle
取消訂閱 unsubscribeTitle, unsubscribeButton, unsubscribeSuccess, unsubscribeProductUnsubscribed

4. 失敗回應

缺少權杖 — 401

{"success": false,"message": "Missing API token"}

權杖無效或已撤銷 — 401

{"success": false,"message": "Invalid or revoked API token"}

請求過多 — 429

未預期的伺服器錯誤 — HTTP 200

{"success": false,"message": "Something went wrong, please try again"}

這個頁面有幫助嗎?

回報問題