Shopify themes, liquid, logos, and UX
Hello,
I have a problem on some product pages, it looks like this:
So it was supposed to be like this:
How can I resolve this?
Solved! Go to the solution
This is an accepted solution.
Hi @Dawenn ,
Please add this code on theme.liquid
{% if product %}
<script>
document.addEventListener("DOMContentLoaded", function() {
const element = document.querySelector('.product-block-list__item.product-block-list__item--info');
const height = element.offsetHeight;
const element2 = document.querySelector('.page__sub-header');
const height2 = element2.offsetHeight;
const h = height + height2 + 200;
document.querySelector('.product-block-list.product-block-list--small').style.minHeight = h + 'px';
});
</script>
{% endif %}
Hi Daniel,
can you provide an example on which products that problem appears?
The ones I've checked are working well!
Seems to be because the buy box element is positioned as absolute. This causes it to overlap the section that sits right below whenever the buttons for choosing your variants switch to a second row when using smaller device widths.
A better way would be to use a grid for positioning that upper section. I got it to work here with a few changes:
But that would require you to change the theme code and also make it responsive for the different Screen sizes.
If you don't feel comfortable with that I think you should seek some help from a theme dev as this is not an easy quick fix.
Hope that helps you a bit!
This is an accepted solution.
Hi @Dawenn ,
Please add this code on theme.liquid
{% if product %}
<script>
document.addEventListener("DOMContentLoaded", function() {
const element = document.querySelector('.product-block-list__item.product-block-list__item--info');
const height = element.offsetHeight;
const element2 = document.querySelector('.page__sub-header');
const height2 = element2.offsetHeight;
const h = height + height2 + 200;
document.querySelector('.product-block-list.product-block-list--small').style.minHeight = h + 'px';
});
</script>
{% endif %}
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024