如何在shopify coming soon页面添加客户名称?
how to add customer name in shopify coming soon page?
我正在寻找一种简单的方法来为我的项目实现一个简单的 "coming soon"(预发布)页面。用户应该能够留下电子邮件和姓名,以便在项目启动时收到通知。
您在此页面上已有 email
字段。当输入他的电子邮件并单击 Notify 按钮时,将为该用户创建一个非活动客户帐户。在启动您的商店时,您可以使用标准 Shopify 功能向所有提交此表单的客户发送帐户邀请。
您提到您还想收集客户姓名。您可以通过向此表单添加其他字段来实现。您正在使用 Debut 主题,因此只需打开 sections/password-content.liquid
文件并在 {% form 'customer' %} ... {% endform %}
标签之间添加这些字段。请注意,由于将创建 Shopify 客户,因此您必须使用两个字段 - 一个用于 first name
,一个用于 second name
。只需复制 email
字段并更改 name
属性。请参阅下面的示例,了解这些字段的外观,注意字段名称如何使用 contact[...]
:
进行分组
<input type="text" name="contact[first_name]" placeholder="First Name">
<input type="text" name="contact[last_name]" placeholder="Last Name">
您还可以更改要在创建时应用到客户的标签。在 Debut 主题中,这些标签默认为 password page
和 prospect
。
添加更多字段
您可以在此页面上收集更多信息。只需添加名称如 contact[note][Field name]
的 "note" 个字段。来自这些字段的信息将显示在 客户备注 字段中。例如,如果你想要求客户留下一个 phone 号码,你可以使用类似的东西:
<input type="text" name="contact[note][Phone]" placeholder="Phone">
您可以遵循本教程中的逻辑:Add fields to the customer registration form。只需确保您使用 contact[]
前缀而不是本教程中描述的 customer[]
对字段进行分组,这实际上是关于另一种形式。
我发现 Debut 主题是,如果你把
<input type="text" name="contact[first_name]" placeholder="First Name">
<input type="text" name="contact[last_name]" placeholder="Last Name">
在这些标签之间 {% form 'customer' %} ... {% endform %}
表单字段被压在一起。
我发现下面的内容对我有用,如果你在 {% form 'customer' %} ... {% endform %}
部分之前添加它:
<center><input
type="text"
name="contact[first_name]"
placeholder="First Name">
<input
type="text"
name="contact[last_name]"
placeholder="Last Name"
></center>
<br>
I've added a screenshot to show you what it looks like in Shopify
This is the final result of my code
我已经通过添加这些字段来捕获名字和第二个名字:
<label>First Name</label>
<input
type="text"
name="contact[first_name]"
id="{{ formId }}-first_name"
class="input-group__field {% if form.errors contains 'first_name' %} input--error{% endif %}"
placeholder="Please enter your first name..."
{%- if form.errors contains 'first_name' -%}
aria-invalid="true"
aria-describedby="{{ formId }}-first_name-error"
data-form-status
{%- endif -%}
>
<label>Last Name</label>
<input
type="text"
name="contact[last_name]"
id="{{ formId }}-last_name"
class="input-group__field {% if form.errors contains 'last_name' %} input--error{% endif %}"
placeholder="Please enter your surname..."
{%- if form.errors contains 'last_name' -%}
aria-invalid="true"
aria-describedby="{{ formId }}-last_name-error"
data-form-status
{%- endif -%}
>
我很想知道如果字段留空如何显示错误。有人知道怎么做吗?
非常感谢。
我正在寻找一种简单的方法来为我的项目实现一个简单的 "coming soon"(预发布)页面。用户应该能够留下电子邮件和姓名,以便在项目启动时收到通知。
您在此页面上已有 email
字段。当输入他的电子邮件并单击 Notify 按钮时,将为该用户创建一个非活动客户帐户。在启动您的商店时,您可以使用标准 Shopify 功能向所有提交此表单的客户发送帐户邀请。
您提到您还想收集客户姓名。您可以通过向此表单添加其他字段来实现。您正在使用 Debut 主题,因此只需打开 sections/password-content.liquid
文件并在 {% form 'customer' %} ... {% endform %}
标签之间添加这些字段。请注意,由于将创建 Shopify 客户,因此您必须使用两个字段 - 一个用于 first name
,一个用于 second name
。只需复制 email
字段并更改 name
属性。请参阅下面的示例,了解这些字段的外观,注意字段名称如何使用 contact[...]
:
<input type="text" name="contact[first_name]" placeholder="First Name">
<input type="text" name="contact[last_name]" placeholder="Last Name">
您还可以更改要在创建时应用到客户的标签。在 Debut 主题中,这些标签默认为 password page
和 prospect
。
添加更多字段
您可以在此页面上收集更多信息。只需添加名称如 contact[note][Field name]
的 "note" 个字段。来自这些字段的信息将显示在 客户备注 字段中。例如,如果你想要求客户留下一个 phone 号码,你可以使用类似的东西:
<input type="text" name="contact[note][Phone]" placeholder="Phone">
您可以遵循本教程中的逻辑:Add fields to the customer registration form。只需确保您使用 contact[]
前缀而不是本教程中描述的 customer[]
对字段进行分组,这实际上是关于另一种形式。
我发现 Debut 主题是,如果你把
<input type="text" name="contact[first_name]" placeholder="First Name">
<input type="text" name="contact[last_name]" placeholder="Last Name">
在这些标签之间 {% form 'customer' %} ... {% endform %}
表单字段被压在一起。
我发现下面的内容对我有用,如果你在 {% form 'customer' %} ... {% endform %}
部分之前添加它:
<center><input
type="text"
name="contact[first_name]"
placeholder="First Name">
<input
type="text"
name="contact[last_name]"
placeholder="Last Name"
></center>
<br>
I've added a screenshot to show you what it looks like in Shopify
This is the final result of my code
我已经通过添加这些字段来捕获名字和第二个名字:
<label>First Name</label>
<input
type="text"
name="contact[first_name]"
id="{{ formId }}-first_name"
class="input-group__field {% if form.errors contains 'first_name' %} input--error{% endif %}"
placeholder="Please enter your first name..."
{%- if form.errors contains 'first_name' -%}
aria-invalid="true"
aria-describedby="{{ formId }}-first_name-error"
data-form-status
{%- endif -%}
>
<label>Last Name</label>
<input
type="text"
name="contact[last_name]"
id="{{ formId }}-last_name"
class="input-group__field {% if form.errors contains 'last_name' %} input--error{% endif %}"
placeholder="Please enter your surname..."
{%- if form.errors contains 'last_name' -%}
aria-invalid="true"
aria-describedby="{{ formId }}-last_name-error"
data-form-status
{%- endif -%}
>
我很想知道如果字段留空如何显示错误。有人知道怎么做吗? 非常感谢。