How can I add various sections in Shopify on register page? For example, phone number? - shopify

How can I add phone number section in Shopify on register page? I want to populate phone numbers of our customers in order to SMS marketing? We are selling pet products, if i could know whether our customers have a cat or a dog, that would be great. I want my customer data to be segmented based on these variables.
</div>
<div class="field">
<input
type="email"
name="customer[email]"
id="RegisterForm-email"
{% if form.email %}
value="{{ form.email }}"
{% endif %}
spellcheck="false"
autocapitalize="off"
autocomplete="email"
aria-required="true"
{% if form.errors contains 'email' %}
aria-invalid="true"
aria-describedby="RegisterForm-email-error"
{% endif %}
placeholder="{{ 'customer.register.email' | t }}"
>
<label for="RegisterForm-email">
{{ 'customer.register.email' | t }}
</label>
</div>
I tried replacing "email" with "phone", however it didn't work.

You can't use phone at register https://shopify.dev/themes/architecture/templates/customers-register, but here are a few solutions:
You can add phone as a field for customer/address and on successful customer register just make another request to save number inside default address. (https://shopify.dev/themes/architecture/templates/customers-addresses)
You can add phone field and save it as a metafield for customer after successful register request. (https://shopify.dev/api/liquid/objects/metafield)

To create a contact page:
From your Shopify admin, go to Online Store > Pages.
Click Add page.
In the Title box, type a title for your contact page, such as Contact us or Get in touch.
In the Content box, type any text that you want to appear above the contact form. You can leave this section blank.
Some information that you might want to add in the Content box:
Short, friendly text such as "We'll get back to you as soon as we can"
Your store's address, with an image of your physical storefront, if you have a retail location
Your phone number, if you want customers to be able to reach you by phone
In the Online store section, choose contact from the Theme template drop-down menu.
Click Save.
Your contact form should now be visible on your Contact page.
You might need to add your contact page to your navigation menu to make it visible on your store.
If your theme supports adding a contact form as a section, then you can add a contact form to existing pages. Refer to Sections and Blocks for more information.
#copied from shopify help center...

Related

How to add a credit card logo in the product page of a Shopify site

Reviewing our Shopify site, I realized that a major difficulty with Shopify is that it's as if the theme does everything possible to obfuscate credit card usage. The site is replete with all sorts of references to Google Pay, Amazon Pay, etc., but credit card payments are always difficult to find.
I would like to know how to add a credit card logo right below the BUY IT NOW button. Could you please let me know if it is possible to do it in Shopify by editing LIQUID file? If so, please point me
Yes, Its possible to do in shopify by editing Liquid file.
You can find code of "Buy It Now" button in your template.
{% if enable_dynamic_buttons %}
{{ form | payment_button }}
{% endif %}
Either code is in sections/product-template.liquid or in snippets/product-form.liquid
You can add code of logo after above code. You can upload logo image either in theme or under files in shopify and then can use HTML code to put logo image.
For e.g.
<img src="{{'creditcardlogo.png' | file_img_url: 'original' }}">

Using Porto theme 3.6.3 in Shopify how can I turn off add to cart on specific products?

In Shopify I need to control whether certain products are able to display add to cart.
In the past I have tagged the product as "hide cart" and switched theme template to a version without the button.
How could I do this using the Porto theme?
Does it have a built in method of doing this or do I need to manipulate the theme partials / templates?
The simplest way that I can think of is to add a tag to all the products that you want to hide the add to cart button from, for example hide-add-to-cart.
Then find the code that renders the button and wrap it in an unless statement:
{% unless product.tags contains 'hide-add-to-cart' %}
<button>Add to cart</button>
{% endunless %}
Does it have a built-in method of doing this or do I need to manipulate the theme partials/templates?
No, there is no way to do it, rather than modify the existing code or add a new template and assign the template to a particular product like your previous theme.
So basically there are 2 ways to achieve it:
as #Karim Tarek said you need to tag those products and then check the particular tag into snippets where the Add to cart formed and disable it or hide it.
you need to create a template where you simply copy the code from the default product template and comment the code is for Add to cart and choose this template for those products on which you don't want to show the Add to cart button.
Code samples:
1.
{% unless product.tags contains 'you tag to hide product' %}
you HTML code that formed the Add to cart button
{% endunless %}

Shopify checkout parameters

I'm working with a client who wants to have an order shipping address be filled on the cart page. I found that you can do it like this https://help.shopify.com/en/themes/customization/cart/use-permalinks-to-preload-cart, so I added few input fields to my cart form with name attributes (e.g. name=" checkout[shipping_address][address1]"). Everything worked ok for me but not for my client. He writes that info auto-filled but it is from memory from other Shopify orders he has made on other websites.
Help appreciated
It's a simple matter of HTML. All you have to do is to set autocomplete input parameter on off like that:
<input type="text" name="checkout[shipping_address][address1]" autocomplete="off" id="customerAddress1">
Documentation: https://www.w3schools.com/tags/att_input_autocomplete.asp
What it's happening here is that your customer is already logged and Shopify checkout is autofilling the customer address info on first step and skipping to checkout step number 2. You need to include &step=contact_information to Shopify checkout always render on first step and then permalink should work regardless if is logged or not.
So you should try adding this input on your cart template:
<input type="hidden" name="checkout[step] value="contact_information">

How to show additional details in shopify admin order?

I am creating an app in Shopify where I have to add additional fields to Shopify and show these fields in the Shopify order admin page. Please guide me to complete this task.
Please see screenshot http://prntscr.com/fsqiux
Thanks
There is no way in Shopify to extend the admin page. If you need to store additional info to an object, for example an order, you can use metafields. What you can do with Metafield and all resources are explained at https://help.shopify.com/api/reference/metafield
You can simply do this by setting cart attributes. No need to create an app.
Documentation
For example, you can use the following code.
<p class="cart-attribute__field">
<label for="new-attribute">New Attribute</label>
<input id="new-attribute" type="text" name="attributes[New Attribute]" value="{{ cart.attributes["New Attribute"] }}">
</p>

shopify: how to redirect user after login form submit on shopify

I am trying to direct users to a specific page after they submit the registration form.
I looked around, and some people suggest using something like this:
{% form 'create_customer' %}
<input type="hidden" name="return_to" value="/pages/registration-success"/>
However, that does not work.
Does any one know how to specify what page a user lands on after submitting a form in Shopify? (I have checked the documentation, and spoken with Shopify tech support. there isn't any documentation on this topic)
I found this somewhere on the web and seems to work.
<input type="hidden" name="checkout_url" value="/pages/registration-success">
I'm just using it in a {%form 'customer_login' %} though and setting it via script to location.href. This allows me to have customers return to the same page after logging in.