I see what you’re trying to do—you want to check if an email is already in your newsletter list and display a different message accordingly. You’re on the right track thinking about Liquid, but since Shopify’s forms don’t automatically validate duplicate emails, you’ll need some custom handling.
How to Show “Already Subscribed” Message for Newsletter Signups
Since Shopify’s native Liquid can’t directly check if an email is already in the list, you’ll need a workaround. Here’s how you can do it:
1. Use JavaScript to Check Email Status
Liquid alone won’t handle this completely, so you’ll need JavaScript to verify if the email exists before form submission.
Example Approach:
When the user enters an email, send an AJAX request to check if it’s already in your customer list (if you store subscribers as customers).
If found, prevent form submission and show “You are already subscribed.”
If not found, proceed with normal form submission.
2. Alternative: Use Shopify Customer Tags (If Customers = Subscribers)
If you store newsletter subscribers as customers with a tag (e.g., newsletter), you can check within Liquid:
{% assign subscriber = false %}
{% for customer in shop.customers %}
{% if customer.email == form.email %}
{% assign subscriber = true %}
{% endif %}
{% endfor %}
{% if subscriber %}
You are already subscribed.
{% else %}
Thanks for subscribing!
{% endif %}
Limitations:
This works only if you use Shopify’s customer system to track subscribers.
It won’t work if you use third-party email marketing apps like Klaviyo or Mailchimp.
Best Approach?
If you just need a quick fix, the JavaScript method is the way to go. If your newsletter list is tied to Shopify customers, you can try the customer tag approach.
Hope that helps! Let me know if you need further clarification.
If you need any other assistance, I am willing to help.
Best regards,
Daisy.