Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to apply character limit in the Gift Wrap field

How to apply character limit in the Gift Wrap field

minimalistbb
New Member
7 0 0

Hi there, I have a gift wrap option and I want to set a character limit to this field - please let me know what and where to copy/paste/edit this code to get that result. Thanks so much! 

 

minimalistbb_0-1643937474059.png

 

Replies 2 (2)

RobDukarski
Shopify Partner
88 15 20

@minimalistbb 

You are going to want to include a "maxlength" attribute on the textarea element. That allows you to set the maximum number of characters the customer can enter.

I am unsure what theme you are using or how many lines of code your files are so I cannot tell anything more specific than that at this time.

Hope that helps!

- Rob Dukarski
Helping to make commerce better for everyone!
minimalistbb
New Member
7 0 0

Hi there! 

 

I tried that after finding this similar post: https://community.shopify.com/c/shopify-design/limit-the-number-of-characters-in-my-gift-message-box...

 

But it didn't work when I previewed it:

minimalistbb_0-1644043739394.png

 

Update: Looks like I had to delete my text and type it in again - it does indeed stop after 50 characters. Thanks for your help!