shopify设置商店模板和将表单字段设置为必填字段步骤-ESG跨境

shopify设置商店模板和将表单字段设置为必填字段步骤

shopify新闻
shopify新闻
2022-03-28
点赞icon 0
查看icon 834

若要防止客户在不选择您是如何了解到我们商店的?表单字段中选项的情况下继续结账,您可以将该字段设置为必填字段。

为配置添加模板设置

  1. 在 Config 目录中,点击 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. 在 Sections 目录中,点击 cart-template.liquid。如果您的模板中不包含 cart-template.liquid,请点击 Templates 目录中的 cart.liquid

  2. 在购物车表单字段中查找以下 novalidate 属性:

novalidate
  1. 将 novalidate 属性替换为以下代码:

{% unless settings.hau_form_validation %}novalidate{% endunless %}
  1. 点击保存

  2. 在模板编辑器中,点击侧边栏上的模板设置

  3. 点击了解我们选项卡。

  4. 表单验证下,确保已启用启用表单验证设置。

备注:您可以通过修改错误消息其他字段错误消息文本字段设置来自定义显示的错误消息。您还可以通过更改错误样式下的颜色设置来自定义错误颜色。

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.



特别声明:以上文章内容仅代表作者本人观点,不代表ESG跨境电商观点或立场。如有关于作品内容、版权或其它问题请于作品发表后的30日内与ESG跨境电商联系。

搜索 放大镜
ESG专业服务案例
查看
1
1个月孵化,GMV增长4400%
【能解决问题的才叫资源 能赚钱的才叫专业】 >> Gmarket卖家店铺经过ESG跨境客户经理优化,月GMV达到20万美金!
2
对接平台官方关键人,3天解封店铺
【精准资源对接 极速解决问题】 >> ESG跨境帮我解决了韩国平台店铺异常问题——运营韩国平台的卖家
3
ESG速度!5小时,PayPal解封
【用资源解决难题 以效率展现专业】 >> ESG拥有Paypal支付和Onbuy平台双绿通道为卖家保驾护航!
4
据理力争,客户产品喜获0竞争绿洲
【只要资源好 跨境弯路少】>> ESG跨境通过专业市场调研分析产品数据,向平台争取机会,卖家成功上架市场热卖而平台稀缺产品,拓展了西班牙新商机!
ESG跨境福利分享群
加入
ESG跨境福利分享群
扫码进群
跨境福利分享群
加入
跨境福利分享群
扫码进群
亚马逊&跨境增长交流群
加入
亚马逊&跨境增长交流群
扫码进群
韩国平台交流群
加入
韩国平台交流群
扫码进群
美国卖家交流群
加入
美国卖家交流群
扫码进群
拉美电商交流群
加入
拉美电商交流群
扫码进群
欧洲多平台交流群
加入
欧洲多平台交流群
扫码进群
开店大全-北美篇
开店大全-蓝海篇
韩国平台站内推广指南-Gmarket Global
CD平台自注册指南
韩国大促热销品预测
开店大全-南亚篇
开店大全-土耳其篇
开店大全-欧洲篇
开店大全-日韩篇
跨境电商运营大全
在线咨询
Shopify平台顾问
Shopify平台问题,问我吧!
通过ESG入驻平台,您将解锁
绿色通道,更高的入驻成功率
专业1v1客户经理服务
运营实操指导
运营提效资源福利
平台官方专属优惠
betvictor代理

立即登记,定期获得更多资讯

订阅
联系顾问

平台顾问

平台顾问 平台顾问

微信扫一扫
马上联系在线顾问

icon icon

小程序

微信小程序

ESG跨境小程序
手机入驻更便捷

icon icon

返回顶部

进行中
全球平台详解——蓝海篇
报名中
Baidu
map