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 %}
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By 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, 2024