Shopify用户注册表单的自定义字段 [英] Custom fields for Shopify User Registration Form
问题描述
我找不到有关如何为用户注册论坛添加自定义字段的任何文档,因此我尝试了一些操作但没有成功:
I can't find any documentation on how to add custom fields for the user registration forum so I tried something but didn't work:
<div class="single-full-width customer">
<div class="login">
{% form 'create_customer' %}
{% if form.errors %}
{% for field in form.errors %}
<p class="input-error-wrapper"><span>{{field}} {{ form.errors.messages[field] }}</span></p>
{% endfor %}
{% endif %}
<p>
<label>First Name:</label>
<input type="text" value="" name="customer[first_name]" class="input-text-1" />
</p>
<p>
<label>Last Name:</label>
<input type="text" value="" name="customer[last_name]" class="input-text-1" />
</p>
<p>
<label>Email Address:</label>
<input type="text" value="" name="customer[email]" class="input-text-1" />
</p>
<p>
<label>Password:</label>
<input type="password" value="" name="customer[password]" class="input-text-1" />
</p>
<p>
<label>Pet Name:</label>
<input type="text" value="" name="customer[pet_name]" class="input-text-1" />
<input type="radio" name="customer[pet]" value="cat">Cat
<input type="radio" name="customer[pet]" value="dog">Dog
</p>
<p class="sign-in">
<label></label>
<a href="#" class="button-1 custom-font-1 trans-1 form-submit-btn"><span>Register</span></a>
<b>or <a href="{{ shop.url }}">Return to store</a></b>
</p>
{% endform %}
</div>
我添加的字段是文本输入-宠物的名字和猫/狗的单选框. 我已经使用了一个测试帐户,但是输出是什么都没有保存.我已经使用{{customer.pet_name}}来尝试获取已保存的值,但没有得到任何回报. 有什么建议?谢谢!
The fields I've added are the text input - pet name and the radio boxes for Cat/Dog. I've used a test account but the output was that nothing is saved. I've used {{ customer.pet_name }} to try and get the saved value but got nothing in return. Any suggestions? Thanks!
推荐答案
将您的宠物名称保存在标签或便笺中,因为这些名称适用于客户. pet_name显然不是客户字段.
Save your pet name in a tag, or a note since those exist for customers. pet_name obviously is not a customer field.
<p>
<label>Pet Name:</label>
<input type="text" value="" name="customer[note]" class="input-text-1" />
<input type="radio" name="customer[tags]" value="cat">Cat
<input type="radio" name="customer[tags]" value="dog">Dog
</p>
这篇关于Shopify用户注册表单的自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!