cancel
Showing results for 
Search instead for 
Did you mean: 

How to display 4 Products in One Column in Product Page?

How to display 4 Products in One Column in Product Page?

How to display 4 Products in One Column in Product Page?
in my product page 3 products are displaying in one column. i want to display 4 product in one column so what changes i have to do?
i am using Magento 2.3

i am using default theme only.Capture.JPG

2 REPLIES 2

Re: How to display 4 Products in One Column in Product Page?

 Hello vital_ticks


You can do this with CSS. Please override below file in your theme and line number 290 - 295

Path : vendor/magento/theme-frontend-luma/Magento_Catalog/web/css/source/module/_listings.less

 

.products-grid .product-item { width: 100%/3 }
.page-layout-1column .products-grid .product-item { width: 100%/3 }
.page-layout-3columns .products-grid .product-item { width: 100%/3 }
.page-products .products-grid .product-item { width: 100%/3 }
.page-products.page-layout-1column .products-grid .product-item { width: 100%/3 }
.page-products.page-layout-3columns .products-grid .product-item { width: 100%/3 }

So you can copy this file into your theme directory, then change those widths like below.

.products-grid .product-item { width: 100%/4 }
.page-layout-1column .products-grid .product-item { width: 100%/4 }
.page-layout-3columns .products-grid .product-item { width: 100%/4 }
.page-products .products-grid .product-item { width: 100%/4 }
.page-products.page-layout-1column .products-grid .product-item { width: 100%/4 }
.page-products.page-layout-3columns .products-grid .product-item { width: 100%/4 }

 

Problem solved and help? Please give 'Kudos' and accept 'Answer as Solution'.

Re: How to display 4 Products in One Column in Product Page?

thanks boss