shopify設(shè)置商店模板和將表單字段設(shè)置為必填字段步驟-ESG跨境

shopify設(shè)置商店模板和將表單字段設(shè)置為必填字段步驟

shopify新聞
shopify新聞
2022-03-28
點(diǎn)贊icon 0
查看icon 1171

若要防止客戶在不選擇您是如何了解到我們商店的?表單字段中選項(xiàng)的情況下繼續(xù)結(jié)賬,您可以將該字段設(shè)置為必填字段。

為配置添加模板設(shè)置

  1. 在 Config 目錄中,點(diǎn)擊 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. 點(diǎn)擊保存

將表單字段設(shè)置為必填字段

若要防止客戶在不選擇您是如何了解到我們商店的?表單字段中選項(xiàng)的情況下繼續(xù)結(jié)賬,您可以將該字段設(shè)置為必填字段。

  1. 在 Sections 目錄中,點(diǎn)擊 cart-template.liquid。如果您的模板中不包含 cart-template.liquid,請點(diǎn)擊 Templates 目錄中的 cart.liquid。

  2. 在購物車表單字段中查找以下 novalidate 屬性:

novalidate
  1. 將 novalidate 屬性替換為以下代碼:

{% unless settings.hau_form_validation %}novalidate{% endunless %}
  1. 點(diǎn)擊保存。

  2. 在模板編輯器中,點(diǎn)擊側(cè)邊欄上的模板設(shè)置

  3. 點(diǎn)擊了解我們選項(xiàng)卡。

  4. 表單驗(yàn)證下,確保已啟用啟用表單驗(yàn)證設(shè)置。

備注:您可以通過修改錯誤消息其他字段錯誤消息文本字段設(shè)置來自定義顯示的錯誤消息。您還可以通過更改錯誤樣式下的顏色設(shè)置來自定義錯誤顏色。

Include the snippet in your cart page

To include the How did you hear about us? snippet in your cart page:

  1. In the Sections directory, click cart-template.liquid. If your theme doesn't include a cart-template.liquid, then click cart.liquid in the Templates directory.

  2. Find the closing </form> tag in the code. On a new line above the closing </form> tag, paste the following code:

    {% render 'hear-about-us' %}
  3. Click Save.

Add theme settings for configuration

  1. In the Config directory, click settings_schema.json.

  2. Find the first closing curly bracket }, in the code. On a new line below the closing curly bracket },, paste the following code:

    { "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" } ] },
  3. Click Save.

Make the form field required

To prevent customers from ceeding to the checkout without selecting an option in the How did you hear about us? form field, you can make the field required.

  1. In the Sections directory, click cart-template.liquid. If your theme doesn't include a cart-template.liquid, then click cart.liquid in the Templates directory.

  2. Find the following novalidate attribute in the cart form code:

    novalidate
  3. Repla the novalidate attribute with the following code:

    {% unless settings.hau_form_validation %}novalidate{% endunless %}
  4. Click Save.

  5. In the theme editor, click Theme settings on the sidebar.

  6. Click the Hear About Us tab.

  7. Under Form Validation, make sure the Enable form validation setting is enabled.



特別聲明:以上文章內(nèi)容僅代表作者本人觀點(diǎn),不代表ESG跨境電商觀點(diǎn)或立場。如有關(guān)于作品內(nèi)容、版權(quán)或其它問題請于作品發(fā)表后的30日內(nèi)與ESG跨境電商聯(lián)系。

搜索 放大鏡
韓國平臺交流群
加入
韓國平臺交流群
掃碼進(jìn)群
歐洲多平臺交流群
加入
歐洲多平臺交流群
掃碼進(jìn)群
美國賣家交流群
加入
美國賣家交流群
掃碼進(jìn)群
ESG跨境專屬福利分享群
加入
ESG跨境專屬福利分享群
掃碼進(jìn)群
拉美電商交流群
加入
拉美電商交流群
掃碼進(jìn)群
亞馬遜跨境增長交流群
加入
亞馬遜跨境增長交流群
掃碼進(jìn)群
亞馬遜跨境增長交流群
加入
亞馬遜跨境增長交流群
掃碼進(jìn)群
拉美電商交流群
加入
拉美電商交流群
掃碼進(jìn)群
ESG獨(dú)家招商-PHH GROUP賣家交流群
加入
ESG獨(dú)家招商-PHH GROUP賣家交流群
掃碼進(jìn)群
《法國Fnac平臺知識百科》
2025跨境電商營銷日歷
《2024年全球消費(fèi)趨勢白皮書——美國篇》
《2024TikTok出海達(dá)人營銷白皮書》
《Coupang自注冊指南》
《eMAG知識百科》
《TikTok官方運(yùn)營干貨合集》
《韓國節(jié)日營銷指南》
《開店大全-全球合集》
《TikTok綜合運(yùn)營手冊》
通過ESG入駐平臺,您將解鎖
綠色通道,更高的入駐成功率
專業(yè)1v1客戶經(jīng)理服務(wù)
運(yùn)營實(shí)操指導(dǎo)
運(yùn)營提效資源福利
平臺官方專屬優(yōu)惠

立即登記,定期獲得更多資訊

訂閱
聯(lián)系顧問

平臺顧問

平臺顧問 平臺顧問

微信掃一掃
馬上聯(lián)系在線顧問

icon icon

小程序

微信小程序

ESG跨境小程序
手機(jī)入駐更便捷

icon icon

返回頂部

【免費(fèi)領(lǐng)取】全球跨境電商運(yùn)營干貨 關(guān)閉
進(jìn)行中
進(jìn)行中
2025跨境電商營銷日歷
包括傳統(tǒng)中、外重要節(jié)日及重點(diǎn)電商營銷節(jié)點(diǎn)還對營銷關(guān)鍵市場、選品輔以說明,讓你的365天安排的明明白白!
免費(fèi)領(lǐng)取
進(jìn)行中
進(jìn)行中
【平臺干貨】eMAG知識百科
涵蓋從開店到大賣6個板塊:開店、運(yùn)營、廣告、選品、上架、物流
免費(fèi)領(lǐng)取
進(jìn)行中
進(jìn)行中
TikTok運(yùn)營必備干貨包
包含8個TikTok最新運(yùn)營指南(市場趨勢、運(yùn)營手冊、節(jié)日攻略等),官方出品,專業(yè)全面!
免費(fèi)領(lǐng)取
進(jìn)行中
進(jìn)行中
韓國coupang平臺自注冊指南
韓國Coupang電商平臺從注冊準(zhǔn)備、提交申請到完成注冊,開店全流程詳細(xì)指引。
免費(fèi)領(lǐng)取
進(jìn)行中
進(jìn)行中
全球平臺詳解——全球合集
涵括全球100+個電商平臺的核心信息,包括平臺精煉簡介、競爭優(yōu)勢、熱銷品類、入駐要求以及入駐須知等關(guān)鍵內(nèi)容。
立即領(lǐng)取
進(jìn)行中
進(jìn)行中
韓國電商節(jié)日營銷指南
10+韓國電商重要營銷節(jié)點(diǎn)詳細(xì)解讀;2024各節(jié)日熱度選品助力引爆訂單增長;8大節(jié)日營銷技巧輕松撬動大促流量密碼。
免費(fèi)領(lǐng)取
進(jìn)行中
進(jìn)行中
全球平臺詳解——?dú)W洲篇
涵蓋20+歐洲電商平臺,詳細(xì)解讀優(yōu)勢、入駐條件、熱銷品等
立即領(lǐng)取
国第一产在线无码精品区,aaa无码视频在线观看,久久强奷乱码老熟女,国产一级aⅴ无码毛片