This code doesn’t work. Any ideas?
We need to add subscribe form on website to create new customers by phone number only.
{%- form ‘create_customer’, class: ‘form’, id: ‘customer_subscribe_form’ -%}
A user is attempting to modify a Shopify Liquid form to collect phone numbers instead of email addresses for customer subscriptions.
Current Situation:
'customer' form with email input and a “ONECLICKBUY” tag'create_customer' form with phone input (customer[phone]) and SMS marketing checkboxTechnical Issue:
Key Elements:
customer[accepts_marketing_sms])The discussion remains unresolved, awaiting either a complete corrected code solution or further troubleshooting of the form submission issue.
This code doesn’t work. Any ideas?
We need to add subscribe form on website to create new customers by phone number only.
{%- form ‘create_customer’, class: ‘form’, id: ‘customer_subscribe_form’ -%}
We use this code to add user as subscriber by email. But we want to change it to Phone Nubmer.
{%- form ‘customer’, id: newsletter_form_id, class: ‘form’ -%}
{%- if form.posted_successfully? -%}
{%- assign success_message = ‘general.newsletter.subscribed_successfully’ | t -%}
{%- render ‘banner’, content: success_message, status: ‘success’ -%}
{%- else -%}
{%- if form.errors -%}
{%- capture error_message -%}{{ form.errors.translated_fields[‘email’] }} {{ form.errors.messages[‘email’] }}{%- endcapture -%}
{%- render ‘banner’, content: error_message, status: ‘error’ -%}
{%- endif -%}
{%- if section.settings.subtext != blank -%}
{{ section.settings.subtext | escape }}
{%- endif -%} {%- endform -%}The code you provided seems to be a Liquid code snippet for creating a customer subscribe form with a phone number input and an SMS marketing checkbox. However, it appears that the formatting is not correct in the text you shared, which could be causing the issue.
Here’s the properly formatted code snippet:
{%- form 'create_customer', class: 'form', id: 'customer_subscribe_form' -%}
{%- capture label -%}{{ 'general.subscribe.phone' | t }}{%- endcapture -%}
{%- render 'input', name: 'customer[phone]', label: label, type: 'tel', required: true, autocomplete: 'tel' -%}
{%- endform -%}