How To Add User As Subscriber use only phone nubmer in form?

Topic summary

A user is attempting to modify a Shopify Liquid form to collect phone numbers instead of email addresses for customer subscriptions.

Current Situation:

  • The original working code uses 'customer' form with email input and a “ONECLICKBUY” tag
  • The attempted modification switches to 'create_customer' form with phone input (customer[phone]) and SMS marketing checkbox
  • The modified code is not functioning as expected

Technical Issue:

  • The posted code contains severe formatting problems with reversed/garbled text (characters appearing backwards)
  • A respondent identified the formatting errors and attempted to provide a corrected version, though the correction itself appears incomplete in the thread

Key Elements:

  • Form includes SMS marketing consent checkbox (customer[accepts_marketing_sms])
  • Uses Liquid templating with form validation and error handling
  • Requires phone number field with tel input type

The discussion remains unresolved, awaiting either a complete corrected code solution or further troubleshooting of the form submission issue.

Summarized with AI on November 20. AI used: claude-sonnet-4-5-20250929.

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’ -%}

{%- capture label -%}{{ 'general.subscribe.phone' | t }}{%- endcapture -%} {%- render 'input', name: 'customer[phone]', label: label, type: 'tel', required: true, autocomplete: 'tel' -%}
{{ 'general.subscribe.agree_sms_marketing' | t }}
{{ 'general.subscribe.subscribe' | t }}
{%- endform -%}

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 -%}

{%- capture label -%}{{ 'general.newsletter.email' | t }}{%- endcapture -%} {%- render 'input', name: 'contact[email]', label: label, type: 'email', required: true, autocomplete: 'email', enterkeyhint: 'send' -%}

BUY WITH HELP
{%- 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 -%}