Limiting number of characters input into a customization collection field in liquid template

Solved
kjpartners
Excursionist
19 0 1

Hi,

 

Let me start by saying I am not developer or coder. I have followed Shopify's instructions on adding customizaton collection fields to my product templates and they show up fine. While I would love to be able to have the customization fields as part of the Buy Button code that we install on our off-Shopify website, that's not going to happen so I'm trying to shore up my listings to make sure the customer has a decent experience that I'm forcing him/her off my website and back to our Shopify store instead. Sorry for the vent.

 

I used Shopify's tools to generate this line of code and added it to the listing -- it works fine but, I'm just saying the personalization is limited to 40 characters. There is no way in the tool to actually stop them from going over and THAT will lead to customer service issues that no business can afford.  I know that I'm missing something like ('maxlength','40'); that needs to go somewhere in this code but I have no idea where or what it actually needs to say.

 

Can you please help me? Thank you in advance for any assistance you can offer me!

 

Jo-Lynn

<p class="line-item-property__field">
  <label for="personalization-up-to-40-characters-including-spaces">Personalization Up to 40 Characters, Including Spaces</label>
  <input required class="required" id="personalization-up-to-40-characters-including-spaces" type="text" name="properties[Personalization Up to 40 Characters, Including Spaces]">
</p>

 

0 Likes
Jasoliya
Shopify Expert
4343 574 1095

This is an accepted solution.

Hi,
Follow this:

<input required maxlength="40" class="required" id="personalization-up-to-40-characters-including-spaces" type="text" name="properties[Personalization Up to 40 Characters, Including Spaces]">

Note: Just add maxlength="40"

 Let me know if need help

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
kjpartners
Excursionist
19 0 1

 

 

 

0 Likes
Jasoliya
Shopify Expert
4343 574 1095

If you want to know more text me on Skype.

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
Kc1980
New Member
1 0 0

Hi,

Just used your text character limiting code. Thankyou. Worked perfectly on my PC and on an iphone but for some reason on a Samsung phone using Chrome I can continue to type more than the alloted amount of characters into the text box. I have customised and item in my store and wanted to reduce the number of characters to 5. If I type numbers it works but if I type letters it continues to go past 5 characters. When I add the item to the cart then it works removing all the extra characters that were in the box. I'm really confused about this. Would you have any idea why this is happening?

 

0 Likes