Customizing the passcode form
Locksmith gives you flexibility in how you can customize the passcode form!
Last updated
Locksmith gives you flexibility in how you can customize the passcode form!
Last updated
Here are some of the many different ways you can edit the passcode form!
This is the default behavior for the message. You can add as much content as you need, including text, images and backgrounds, by simply adding code directly to the "Passcode prompt" area, found on the lock page, under Messages:
Any code that you add to this area will be rendered normally, as if adding it to the theme. Including:
HTML - using regular HTML tags
CSS - using <style> your CSS code here </style>
Javascript - using <script> your javascript code here </script>
Liquid - using regular Liquid syntax
Simply use {{ locksmith_passcode_form }} to denote where the form itself will go, and then add in content that you want to display before and after it.
This is not done in the Locksmith app, but rather in the theme's "Edit default theme content" settings:
Once in the "Theme content" settings, you'll need to go to the "Locksmith" tab, which is typically not visible right away:
So then finally, you can edit the text itself, under the Locksmith tab:
Note: This step only changes the wording for your default language. If you are using multiple languages in your store, you'll also need to go through the "Localize" step. Check out Shopify's guide on doing that here.
If you have multiple key condition types on the same lock, it might be useful to include other form types within the prompt, so that they display on the same page. We have a guide on doing this here:
Showing multiple prompts on the same pagePlease note that this is NOT compatible with replacing/editing the form itself (as detailed in the next section).
Some merchants want more control over the form itself, not just the text that is shown alongside it. This could just be for more granular edits to the way it looks, or to perform more complicated javascript operations on the text input.
Although we can help troubleshoot, if you choose to override the form, the coding and style is up to you, we are not able to create a new form for you.
To do this, simply use the "Passcode prompt" area to put in your new form. Since you're overriding the form, you'll need to add in all the code for the new form. To begin, copy/paste this entire section (including the script!) into the Messages > Passcode prompt area. Then, edit as needed:
If you need to perform text transforms (e.g. downcasing the text for case-insensitivity), do that in the marked area in the script above.
Editing tips
Changing the form too extensively (editing the text input, script, classes/ids) could cause the passcode not to be submitted correctly, so try to stick as close to the above as possible.
Locksmith will look for the <form> tag with the "locksmith_passcode_form" id, so that's something to keep in mind if you see that Locksmith is still rendering the default form when overriding:
Here are a few examples of how you might use CSS to style your passcode messages. You can put these directly in your passcode messages in Locksmith (making sure to surround them with the <style> ... </style>
tag), or add them to the stylesheets in your theme.
With jquery:
With vanilla javascript:
While we cannot make extensive custom edits to your form for you, if you have any questions you can contact us via email at team@uselocksmith.com