- This Shopify Liquid code creates a responsive shopify contact form with an elegant popup thank-you message. It features AJAX submission, schema markup for SEO, and mobile-friendly styling.
- Need help implementing this? Contact a Shopify developer for professional customization and integration services to make it work perfectly for your store.
Shopify Schema Code
{% schema %}
{
"name": "Contact Form with Popup",
"settings": [
{
"type": "text",
"id": "heading",
"label": "Heading",
"default": "Contact Us"
},
{
"type": "richtext",
"id": "description",
"label": "Description",
"default": "Have questions? Fill out the form below and we'll get back to you soon.
"
},
{
"type": "text",
"id": "submit_text",
"label": "Submit Button Text",
"default": "Send Message"
},
{
"type": "text",
"id": "success_message",
"label": "Success Message",
"default": "Thanks for contacting us. We'll get back to you soon!"
},
{
"type": "text",
"id": "popup_close_text",
"label": "Popup Close Button Text",
"default": "Close"
}
],
"presets": [
{
"name": "Contact Form with Popup",
"category": "Forms"
}
]
}
{% endschema %}
Shopify Liquid Code
{{ section.settings.heading }}
{{ section.settings.description }}
{% form 'contact', class: 'contact-form__form' %}
{% if form.errors %}
{{ form.errors | default_errors }}
{% endif %}
{% endform %}
Thank You!
{{ section.settings.success_message }}
CSS Code
{% style %}
.contact-form {
max-width: 600px;
margin: 0 auto;
padding: 2rem;
}
.contact-form__field {
margin-bottom: 1.5rem;
}
.contact-form__label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
}
.contact-form__input,
.contact-form__textarea {
width: 100%;
padding: 0.75rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 1rem;
}
.contact-form__textarea {
min-height: 150px;
resize: vertical;
}
.contact-form__submit {
background-color: #000;
color: #fff;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
transition: opacity 0.2s;
}
.contact-form__submit:hover {
opacity: 0.9;
}
.errors {
color: #d32f2f;
margin-bottom: 1rem;
}
/* Popup Styles */
.contact-popup {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
z-index: 9999;
justify-content: center;
align-items: center;
}
.contact-popup__content {
background-color: white;
padding: 2rem;
border-radius: 8px;
max-width: 500px;
width: 90%;
text-align: center;
position: relative;
}
.contact-popup__close {
position: absolute;
top: 10px;
right: 10px;
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
}
.contact-popup__message {
margin: 1rem 0;
font-size: 1.1rem;
}
.contact-popup__button {
background-color: #000;
color: #fff;
padding: 0.5rem 1rem;
border: none;
border-radius: 4px;
cursor: pointer;
margin-top: 1rem;
}
{% endstyle %}
Java Script Code
Key Features:
Popup Thank You Message:
Shows a modal/popup when form is successfully submitted
Includes close button and can be closed by clicking outside
AJAX Form Submission:
Submits the form without page reload using fetch API
Better user experience
Popup Styling:
Centered modal with semi-transparent backdrop
Clean, modern design
Additional Settings:
Added setting for popup close button text
Accessibility:
Properly handles body scroll when popup is open
Multiple ways to close the popup (button, X, click outside)
With 7+ years of experience in Shopify development, eCommerce solutions, and SEO, I have successfully delivered 100+ high-performing Shopify stores that drive conversions and enhance user experience.
Latest posts by Shahrukh Miya (see all)
- How To Add Before And After Slider To Shopify? - April 12, 2025
- How to add a Table of Contents for your Blog Posts Using Shopify - April 10, 2025
- How to Add Custom Image with Text section in Shopify (Step-by-Step Guide) - April 10, 2025