Shopify Integration
Shopify Contact Form Integration
Collect form submissions from your Shopify store using FormAPI. You can add custom HTML/JS forms in your Shopify theme or pages to send data directly to FormAPI.
VS Code
<form id="formapi-shopify" onsubmit="handleSubmit(event)">
<label>Email:</label>
<input type="email" name="email" required />
<label>Message:</label>
<textarea name="message" required></textarea>
<button type="submit">Send</button>
</form>
<p id="success-message" style="color:green; display:none">Form submitted successfully!</p>
<p id="error-message" style="color:red; display:none"></p>
<script>
async function handleSubmit(event) {
event.preventDefault();
const form = event.target;
const email = form.email.value;
const message = form.message.value;
const successEl = document.getElementById('success-message');
const errorEl = document.getElementById('error-message');
successEl.style.display = 'none';
errorEl.style.display = 'none';
try {
const res = await fetch('https://submit.zunoy.com/sub/[YOUR-FORM-KEY]', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
body: JSON.stringify({ email, message })
});
const data = await res.json();
if (data.code === 200) successEl.style.display = 'block';
else {
errorEl.textContent = data.message || 'Something went wrong';
errorEl.style.display = 'block';
}
} catch (err) {
errorEl.textContent = err.message;
errorEl.style.display = 'block';
}
}
</script>How to Integrate Code
What is Shopify?
Shopify is a hosted e-commerce platform that allows you to create online stores using themes and templates. Custom forms can be added using Liquid and JavaScript to integrate with external services like FormAPI.
FormAPI Setup in Shopify with Fetch
Use the Fetch API inside a