Mastering Your Shopify Newsletter Popup: Trigger It with Any Button Click!

Hey there, fellow store owners! Let's talk about one of those common little customizations that can make a big difference to your site's user experience: getting your newsletter popup to appear exactly when and where you want it. We've all been there, right? You've got a great signup form, but the default 'pop up after X seconds' or 'exit intent' isn't quite cutting it for a specific call to action.

Recently, a store owner named Aimonestar, running DREVM SWIMWEAR on the popular Symmetry theme by Clean Canvas, hit the Shopify Community with this exact challenge. They wanted their existing newsletter popup to open when visitors clicked a "Secure My Slot" button on their "Dreamlist" page. The theme developer couldn't help, so Aimonestar turned to the community for some JavaScript magic. And boy, did the community deliver!

DREVM SWIMWEAR logo

The Challenge: Taking Control of Your Popups

Aimonestar's situation is pretty common: a theme comes with a built-in newsletter popup, which is great, but the trigger options are limited. You might want to tie that popup to a specific button like "Get Your Discount," "Join Our Waitlist," or in Aimonestar's case, "Secure My Slot." This gives you more control and a better conversion flow than just hoping someone sticks around for a timed popup.

Community Insights: Two Paths to Popup Power

The community discussion highlighted two main approaches to tackling this, both involving custom JavaScript. One is a bit more direct, and the other leverages your theme's existing JavaScript for a more integrated feel.

Approach 1: Direct CSS Class Manipulation (The "Inspector" Method)

This method, championed by community members like derek_lee and Maximus3, focuses on how most modern popups work: they're typically hidden elements on your page that become visible when certain CSS classes are added. The trick is to find those classes and then use JavaScript to add them when your button is clicked.

Step-by-Step for the Direct CSS Method:

  1. Inspect Your Popup: Open your Shopify store in an incognito browser window (to ensure the popup shows as if it's a first visit). Manually trigger the newsletter popup (if it has an automatic trigger).
  2. Identify the Key Elements: Right-click on the open popup and select "Inspect" (or "Inspect Element"). In the Elements panel of your browser's developer tools, look for a
    element near the bottom of the that represents the popup container. It might have an ID like popup_signup_....
  3. Spot the "Open" Classes: Pay close attention to the classes added to this container
    when the popup is open. For Symmetry theme, derek_lee noted they're often something like visible and animation--popup-revealed. Maximus3 also pointed this out, showing screenshots of these classes in action for a popup_signup_KjfyyB ID.

Once you have those, you'd add a snippet of JavaScript to your theme:

document.querySelector('.your-button-class').addEventListener('click', function() {
  document.querySelector('#popup_signup_YOURID').classList.add('visible', 'animation--popup-revealed');
});

You'd replace .your-button-class with a selector for your button (e.g., #secure-my-slot-button if you added an ID as Wsp suggested) and #popup_signup_YOURID with the actual ID you found. This code simply listens for a click on your button and then applies the necessary CSS classes to the popup container, making it appear.

Approach 2: Leveraging Theme's Built-in Popup Logic (The Robust Way)

While the direct CSS method works, a more robust solution, shared by tim_1, involves interacting with your theme's JavaScript objects directly. This ensures that any additional logic your theme has for its popups (like setting cookies to prevent it from showing again, or specific animations) is properly triggered. This method also cleverly disables the automatic popup display, giving your button full control.

Step-by-Step Implementation for tim_1's Method:

  1. Prepare Your Theme: Aimonestar was smart to do this already: always duplicate your live theme before making any code changes. This way, you can test without fear of breaking your store! Go to Shopify Admin > Online Store > Themes > Actions > Duplicate.
  2. Add the Custom Liquid Section: In your duplicated theme, go to Online Store > Themes > Actions > Edit Code. In the left sidebar, under the "Sections" or "Snippets" directory, you might want to create a new snippet, or as tim_1 suggested, add a "Custom liquid" / "Custom code" section to your "Footer group" (this is particularly easy with OS 2.0 themes). Alternatively, you can paste this code at the very bottom of your theme.liquid file, just before the closing tag.
  3. Insert the JavaScript Code: Paste this JavaScript snippet into your chosen location. This code will run once your page is ready, find the newsletter popup, disable its auto-trigger, and then listen for clicks on specific links to open it programmatically.

  1. Create Your Trigger Button/Link: Now, wherever you want your button to live (e.g., your "Dreamlist" page for Aimonestar), create an HTML link ( tag) that points to #newsletter-popup. For example: Secure My Slot. This href is what the JavaScript is listening for.

What this code does is pretty clever: it first identifies your theme's newsletter popup element. Then, it modifies the data-delay-seconds attribute to a very high number (864001 seconds, which is about 10 days), effectively stopping the popup from showing up automatically. After that, it sets up an event listener that waits for any click on the page. If the clicked element (or one of its parent elements) is an tag and its href includes #newsletter-popup, it prevents the default link behavior and then uses your theme's own JavaScript objects (theme.Sections._instances and popup.open()) to open the popup. This is a very clean way to integrate with your theme's native functionality!

Which Approach is Right for You?

For most store owners, especially those on modern Shopify themes, tim_1's method is generally preferred. It's more robust because it interacts with the theme's built-in popup mechanism, which means it's less likely to break if the theme's underlying CSS classes change, and it respects any other popup logic (like cookie settings for 'don't show again').

The direct CSS manipulation approach can work well for simpler popups or if you're very familiar with your theme's code, but it requires you to manually find and maintain those specific CSS classes. Another community member, namphan, even suggested digging into the theme.js file to find theme.Popup and change code there, but this is a much more advanced and potentially risky modification, best left to experienced developers.

No matter which path you choose, remember to always test your changes thoroughly on a duplicated theme first! This little bit of custom code can give you a lot more flexibility in how you engage your customers with your newsletter signup, so go ahead and give it a try!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases