I currently have 5 columns wide on desktop, the slider to adjust the columns in my editor doesn’t work so I think I’m going to have to do it through code, i was hoping to make it 4, any help would be greatly appreciated.
Topic summary
A user needs to change their Shopify store’s product grid from 5 columns to 4 columns on desktop. The built-in column slider in their theme editor is not functioning, requiring a code-based solution.
Multiple CSS solutions were provided:
- Most common approach: Add custom CSS to
base.cssfile targeting.product-grid .grid__itemwithwidth: calc(25% - var(--grid-desktop-horizontal-spacing) * 3 / 4) - Alternative methods: Add code to theme.liquid file or use the theme customizer’s Custom CSS section
- Media queries: Solutions typically target screens with minimum width of 768px or 990px
Key variations in suggested code:
- Some solutions include
!importantflags for override priority - One approach adjusts grid gap spacing
- Different CSS selectors were recommended (
.grid li,.grid--4-col-desktop .grid__item, etc.)
After the user shared their store URL, responders provided updated, more specific solutions with visual results showing the 4-column layout. The discussion remains open as the user has not confirmed which solution worked.
Hello @MaiaMonange ,
Could you please provide the URL/ password to your store so that I can check it and provide you with the exact solution?
Hi @MaiaMonange
Let’s go to Shopify Admin → Sales Channels → Online Store → click to edit code your current theme → open file base.css then add this custom CSS code to the bottom of file:
@media screen and (min-width: 768px) {
.product-grid .grid__item {
width: calc(25% - var(--grid-desktop-horizontal-spacing) * 3 / 4) !important;
}
}
This is the result:
Hi @MaiaMonange,
Please go to Customize > Sections > Featured collection > Custom CSS and add code:
@media screen and (min-width: 990px) {
.grid.product-grid .grid__item {
width: calc(25% - var(--grid-desktop-horizontal-spacing) * 3 / 4);
max-width: calc(25% - var(--grid-desktop-horizontal-spacing) * 3 / 4);
}
}
Hello @MaiaMonange ,
Here are the steps to apply the necessary changes in your Shopify store:
- In your Shopify Admin, navigate to Online Store > Themes > Actions > Edit Code.
- Locate Asset > base.css and paste the following code at the bottom of the file:
@media screen and (min-width:768px){
.grid--4-col-desktop .grid__item {
width: calc(25% - var(--grid-desktop-horizontal-spacing) * 3 / 4) !important;
}
.grid{
gap:4px !important;
}
}
Let me know if you need further assistance!
Hi @MaiaMonange ,
Typically, most themes offer a setting to control how many products are displayed per row in a collection on desktop. For example, as shown in the screenshot below:
In case your theme doesn’t support this feature, you can manually override it by adding some custom CSS to display 5 items per row. For instance, the following CSS snippet:
@media screen and (min-width: 990px) {
.product-grid .grid__item {
width: calc(25% - var(--grid-desktop-horizontal-spacing) * 3 / 4) !important;
}
}
I’d be happy to give you the best advice if you could share your store URL with me. I’m more than happy and willing to help!
my url is link
Hey @MaiaMonange
Follow these Steps:
- Go to Online Store
- Edit Code
- Find theme.liquid file
- Add the following code in the bottom of the file above </ body> tag
<style>
.grid li {
width: 25% !important;
max-width: 25% !important;
}
</style>
RESULT
If I managed to help you then a Like would be truly appreciated.
Best,
Moeed
Hi @MaiaMonange,
Please go to Customize > Sections > Featured collection > Custom CSS and add code:
@media screen and (min-width: 990px) {
.grid.product-grid .grid__item {
width: 25% !important;
max-width: 25% !important;
}
}
If I helped you, then a Like would be truly appreciated.
Try this updated code instead with the same steps mentioned above.
<style>
.grid li {
width: 25% !important;
max-width: 25% !important;
margin-left: -1px !important;
}
</style>
If I managed to help you then a Like would be truly appreciated.
Best,
Moeed




