Shopify themes, liquid, logos, and UX
Hi guys,
I'd like to define a maximum height to my product images, so that too large images do not mess up my product page.
In theory, it should work with the following custom CSS for the product page, as it also works perfectly fine in the editor/preview. But when saving it, it throws the error: "Session in the online store editor cannot be published" (Or similar, as my language setting is German, there is says: "Sitzung im Onlineshop-Editor kann nicht veröffentlicht werden".)
.product-image-main {
img {
height: 600px;
object-fit: contain;
}
}
I would like to avoid situation like this (image has only 600px height, I don't know why it gets so big):
Help is very much appreciated ❤️
Solved! Go to the solution
Yes sure, the link is: https://www.cdc-reitsport.com/products/cxevalo-hufpuder-fur-pferde
Will try out your suggestion in a few seconds!
Edit: @suyash1 Many many thanks! It worked 👏 😍 Did not think that it would be that easy. Lovely, thanks a lot!
Just to test out one more thing, I removed the styling once again. Do you maybe also have an idea why it tries to scale my image in such a weird way? If you compare it with other products, it does not happen everywhere, only on this product 🤔
Do you have any idea why it gets rendered to that big version? Usually it shows all my images in the actual size, that's why I am confused what's happening here... E.g. if you compare with different products like https://www.cdc-reitsport.com/products/carubina-damen-vollbesatzreithose-calorena
Both use the design for a standard product.
Thank you so much! I will check if I can finde someone 🙂
Hi @LuiPru
You can add the code in the head liquid instead, please follow these steps:
Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code
Step 2: Search file theme.liquid
Step 3: Insert this code above </head>
Don't forget to add the {% style %} at the beginning of the code and {% endstyle %} at the end of the code
I hope this helps
Best,
Daisy
Thank you @DaisyVo as well! As the suggestion from the user above worked, I did't not even test your suggestion (although because I am pretty afraid of touching the code directly 😅). Nevertheless, thank you for your help 👏
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025