How can I link a page button to a pop-up form on my site?

How can I link a page button to a pop-up form on my site?

albaq
Tourist
11 0 1

I want to link a button on my page to a pop-up form for our visitors to fill in. How can I do that? 

 

I currently use the forms app on Shopify.

Replies 6 (6)

zaczee
Globetrotter
855 46 42

Hi,

 

Can you let us know which page do you want the form to link

albaq
Tourist
11 0 1

I want the button to link to a form. And I want that form to collect emails. 

zaczee
Globetrotter
855 46 42

HI,

 

Are you using any apps to create forms or you need to code to create the popup and form

albaq
Tourist
11 0 1

I currently use the forms app on Shopify.

 

BSS-Commerce
Shopify Partner
3477 463 538

Hi @albaq ,

You can try this way:

Step 1:  Hide your form by adding the following code to the file (theme.css, global.css, ...)

 

.your_form{
  display:none;
}

Step 2:  Add this code to your js (global.js or theme.js, ..)

 

const btn = document.querySelector(".your_button");
const form = document.querySelector(".your_form");
const close_form = document.querySelector(".your_close_form");
if(btn){
  btn.addEventListener("click" ,() => {
    form.classList.add("active");
  })
}
if(close_form){
  close_form.addEventListener("click" ,() => {
    form.classList.remove("active");
  })
}

Step 3: Add the following code into the css file (theme.css, global.css,...) to display the form after clicking the button

 

.active{
  display:block!important;
}

Hope it helps @albaq ! 

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


B2B Solution & Custom Pricing | Product Labels by BSS


Need help from our expert? Kindly share your request with us via [email protected]


BSS Commerce - Full-service eCommerce Agency
parisiem
Excursionist
14 0 6

Hi there,

 

I saw your solution for linking a page button to a pop-up form and I'm hoping you might be able to help with a similar issue I'm trying to solve.

 

I want to add a button on the product page that says "Add a gift message 🎁" which links to a pop-up form where people can add or edit a gift message that I will hand write with their order. There's a Shopify app that does something similar but it emails the gift recipient instead of just adding a note to the back end of their order.

 

Is this something you might be able to help with?

 

Many thanks,

 

Emma

 

Screenshot 2024-04-24 at 11.39.44.pngScreenshot 2024-04-24 at 11.40.05.png