詢問顧客如何得知您的商店

您可以將「您從何種管道得知我們的商店?」表單欄位新增至購物車頁面,以詢問顧客從哪裡聽說您的商店。

您從何種管道得知我們的商店?

建立「您從何種管道得知我們的商店?」表單欄位

在購物車頁面中包含程式碼片段

若要在您的購物車頁面中加入「您從何種管道得知我們的商店?」程式碼片段:

  1. 在「區段」目錄中,點擊「cart-template.liquid」。如果您的佈景主題不包含「cart-template.liquid」,則可以在「範本」目錄中,點擊「cart.liquid」。

  2. 找到程式碼中的結束標籤 </form>。在結束標籤 </form> 上方新的一行,貼上下列程式碼:

{% render 'hear-about-us' %}
  1. 點擊「儲存」。

為配置設定新增佈景主題設定

  1. 組態目錄中,點擊「settings_schema.json」。

  2. 在程式碼中尋找第一個右大括號「},」。在右大括號「},」下方新的一行貼上以下程式碼:

{
"name": "Hear About Us",
"settings": [
    {
        "type": "text",
        "id": "hau_form_options",
        "label": "Form options",
        "default": "Facebook, Twitter, Google, Instagram, Youtube",
        "info": "Separate each option with a comma"
    },
    {
        "type": "header",
        "content": "Form validation"
    },
    {
        "type": "checkbox",
        "id": "hau_form_validation",
        "label": "Enable form validation",
        "default": true
    },
    {
        "type": "text",
        "id": "hau_error_message",
        "label": "Error message",
        "info": "The error message that is displayed when no selection is made",
        "default": "Please select an option below"
    },
    {
        "type": "text",
        "id": "hau_error_message_other",
        "label": "Other field error message",
        "info": "The error message that is displayed when there is no input in the 'Other' field",
        "default": "Please fill the text field below"
    },
    {
        "type": "header",
        "content": "Error styling"
    },
    {
        "type": "color",
        "id": "hau_error_color",
        "label": "Color",
        "default": "#ff0000"
    }
]
},
  1. 點擊「儲存」。

將表單欄位設為必填

若您想避免顧客未在「您從何種管道得知我們的商店?」表單欄位中選取選項就進入結帳頁面,可以將該欄位設為必填。

  1. 在「區段」目錄中,點擊「cart-template.liquid」。如果您的佈景主題不包含「cart-template.liquid」,則可以在「範本」目錄中,點擊「cart.liquid」。

  2. 在購物車表單程式碼中尋找下列「novalidate」屬性:

novalidate
  1. 用以下程式碼取代「novalidate」屬性:
{% unless settings.hau_form_validation %}novalidate{% endunless %}
  1. 點擊「儲存」。

  2. 佈景主題編輯器中,點擊側邊欄的「佈景主題設定」

  3. 點擊「得知我們的商店」分頁。

  4. 「表單驗證」下,確認已啟用「啟用表單驗證」設定。

設定您的選項

如果您要自訂「您從何種管道得知我們的商店?」下拉式選單中的選項,可以使用佈景主題編輯器中的佈景主題設定來編輯選項。

  1. 佈景主題編輯器中,點擊「佈景主題設定」

  2. 點擊「得知我們的商店」分頁。

  3. 「表單選項」下新增或移除選項,並以逗號分隔各選項。

  4. 點擊「儲存」。

常見問題

我可以在何處查看擷取的資料?

您可以在管理介面找到訂單,然後從訂單的「其他詳細資訊」區段中看到答案:

訂單的「其他詳細資訊」區段

如果顧客在選項清單中找不到答案,可自行輸入內容嗎?

可以。如果顧客選取「其他」,在下拉式選單的下方會出現一個可供輸入答案的文字方塊

我可以在新訂單通知電子郵件中顯示答案嗎?

可以。若要在新訂單通知電子郵件中顯示顧客回應內容,請執行以下操作:

  1. 前往管理介面中的「通知」頁面,並在「新訂單」電子郵件範本新增以下程式碼:
This customer heard about us through {% if attributes.how-did-you-hear-about-us-other == blank %}{{ attributes.how-did-you-hear-about-us }}{% else %}{{ attributes.how-did-you-hear-about-us-other }}{% endif %}.
  1. 點擊「儲存」。

準備好開始透過 Shopify 銷售商品了嗎?

免費試用