how to add a inout text filed before add to cart button for specific collection's products

Solved

how to add a inout text filed before add to cart button for specific collection's products

Advertfox
Shopify Partner
82 0 16

hi,

 

i want to create input text filed before add to cart button on product page to get email of client before making purchase, i want it for specific collection's products. not for all products.

 

any suggestion ? 

 

below is my store link and pswd and i want for my wix templates collection

 

https://advertfox.myshopify.com/

 

pswd: advertfox

Accepted Solution (1)
Guleria
Shopify Partner
3947 791 1122

This is an accepted solution.

Done, check it with tproduct https://advertfox.myshopify.com/products/candy-pastel-instagram-story-template
It will display only show with the product where metafield Display input field is enabled.

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder

View solution in original post

Replies 21 (21)

qasim-devloper
Shopify Partner
139 9 20

You are using outdated vision of Shopify Dawn theme. Please update the theme with the latest virsion so that I provide you updated code.

Thanks

- Need a Shopify Specialist? Chat on WhatsApp +923289643774

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button!

Advertfox
Shopify Partner
82 0 16

do i need redo all the design if i update the theme ? thank you

qasim-devloper
Shopify Partner
139 9 20

No,
You have to make a copy of your theme and then you can update the theme.

- Need a Shopify Specialist? Chat on WhatsApp +923289643774

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button!

qasim-devloper
Shopify Partner
139 9 20

When It's done Let me know I will provide you code.

- Need a Shopify Specialist? Chat on WhatsApp +923289643774

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button!

Advertfox
Shopify Partner
82 0 16

not really sure how to do it

Guleria
Shopify Partner
3947 791 1122

Hello @Advertfox ,

 

Please follow to add field in PDP page https://ui-elements-generator.myshopify.com/pages/line-item-property

To make it available for specific collection, you can use meatfiled to make it conditional.

or use an alternate template for specific collection products.

 

Regards
Guleria

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Advertfox
Shopify Partner
82 0 16

hi,

 

thank you for the response, can you please help me with more steps, i'm not sure which metafield i have to select since not showing any for the custom code. 

 

thanks for your help

Guleria
Shopify Partner
3947 791 1122

You need to use type Text -- Short

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Advertfox
Shopify Partner
82 0 16

well, in that case do i need to paste below code on product.liquid page ?

 

<p class="line-item-property__field">
<label for="your-name">Your name</label>
<input id="your-name" type="text" name="properties[Your name]">
</p>

Advertfox
Shopify Partner
82 0 16

i have assigned one text metafield to one of my the product and pasted given custom code within in it.

but not sure what to do next on the product page 

Guleria
Shopify Partner
3947 791 1122

 

Find the form tag in sections -> main-product.liquid
or snippets product-form.liquid

and paste the code there.

If you need further help you can drop an email or PM the store collaborator code and I'll do it for you.

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Guleria
Shopify Partner
3947 791 1122

Request sent!

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Guleria
Shopify Partner
3947 791 1122

This is an accepted solution.

Done, check it with tproduct https://advertfox.myshopify.com/products/candy-pastel-instagram-story-template
It will display only show with the product where metafield Display input field is enabled.

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Advertfox
Shopify Partner
82 0 16

thanks a lottt for your help :)))) 

Guleria
Shopify Partner
3947 791 1122

1) Created metafield with name Display input field and type True or false.

 

2) Code in snippets -> buy-buttons.liquid

Just after this code

{%- form 'product',
        product,
        id: product_form_id,
        class: 'form',
        novalidate: 'novalidate',
        data-type: 'add-to-cart-form'
      -%}

 

Here is the code

         {% if product.metafields.custom.display_input_field %}
            <div class="fields custminut"> 
              <label for="email">Email</label>
            <input required class="required field__input" placeholder="Email" id="email" type="email" name="properties[Email]">
            </div>
          {% endif %}

 

Regard
Guleria

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Advertfox
Shopify Partner
82 0 16

that worked like a butter, thank you 🙂

Advertfox
Shopify Partner
82 0 16

hi,

 

also i wanted to ask something, i have created metafield to assign different banners collection vise. however in some collection i just want to keep titles. is there any suggestion ?

 

thanks again for all your help. 

Guleria
Shopify Partner
3947 791 1122

I think if you leave meatafield blank for specific collection then by default it will pick the collection title. 

btw if such option is not available in theme theme you re using then you need to write that logic. 

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Advertfox
Shopify Partner
82 0 16

Hi, when i try to keep metafield blank then it shows default image on the collection page instead of title. 

Guleria
Shopify Partner
3947 791 1122

hmm then it needs customization.

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Advertfox
Shopify Partner
82 0 16

alright