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 %}
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025