Shopify themes, liquid, logos, and UX
Hello, how can one put shopifys default contact form into my custom link popup? code below...
<div class="box">
<a class="button" href="#popup1">Contact us</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2 style="font-size:20px">XXXXXXXX</h2>
<a class="close" href="#">×</a>
<div class="content" style="font-family: work sans; font-size:14px;">
-----------ENTER SHOPIFY DEFAULT CONTACT FORM HERE -----------
</div>
</div>
</div>
<style>
h2 {
text-align: left;
font-family: work sans;
font-weight:500;
color: #000;
}
.payment {
max-width: 200px;
}
.button {
font-family: work sans;
font-weight: 500;
font-size: 14px;
padding: 10px;
color: #000;
text-decoration: underline;
text-underline-offset: 4px;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
text-decoration: none;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
width: 40%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #000;
font-family: work sans;
}
.popup .close {
position: absolute;
top: 10px;
right: 20px;
transition: all 200ms;
font-size: 30px;
font-weight: 500;
text-decoration: none;
color: #000;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
@media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
.secure{font-weight:500;}
.free{font-weight:500;}
</style>
Hi @xnyjyh
You can try to update your code to this and check
<div class="box">
<a class="button" href="#popup1">Contact us</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2 style="font-size:20px">XXXXXXXX</h2>
<a class="close" href="#">×</a>
<div class="content" style="font-family: work sans; font-size:14px;">
{% section 'contact-form' %}
</div>
</div>
</div>
<style>
h2 {
text-align: left;
font-family: work sans;
font-weight:500;
color: #000;
}
.payment {
max-width: 200px;
}
.button {
font-family: work sans;
font-weight: 500;
font-size: 14px;
padding: 10px;
color: #000;
text-decoration: underline;
text-underline-offset: 4px;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
text-decoration: none;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
width: 40%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #000;
font-family: work sans;
}
.popup .close {
position: absolute;
top: 10px;
right: 20px;
transition: all 200ms;
font-size: 30px;
font-weight: 500;
text-decoration: none;
color: #000;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
@media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
.secure{font-weight:500;}
.free{font-weight:500;}
</style>
- Helpful? Like and Accept solution!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Hi Dan,
I get this error:
Liquid error (sections/main-product line 297): Cannot render sections inside sections
I recommend you put that code in your theme.liuqid file instead of adding code in another section liquid file
- Helpful? Like and Accept solution!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
So should I leave :
<div class="box">
<a class="pop-button" href="#popup1">Shipping & Returns</a>
</div>
and the rest in theme.liquid?
Yes, it worked leaving the :
<div class="box">
<a class="pop-button" href="#popup1">Contact us</a>
</div>
...in product-main and rest of code in theme.liquid!
Hmmm, i ran into a weird problem! when I refresh any page and after even clearing cache/cookies. the contact form flashes for a quick moment. If you go to my site you will see what I mean when you refresh any page.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024