Archived topic
Woocommerce Search Results Page - Change number of columns
3 replies · Started by Sarah on July 8, 2020
Hi,
I have some custom code in funtions.php that makes the main shop page only display 2 columns.
function my_custom_css() {
if (function_exists('is_shop') && is_shop()) {
echo "<style type='text/css'>.woocommerce .wc-columns-container.wc-columns-4 .products{grid-template-columns: repeat(2,minmax(0,1fr));}</style>";
}
}
add_action('wp_head', 'my_custom_css' );
I am also using WOOF product filter which basically displays results (based on filters) on the 'main' shop page. I want these results to be displayed in 4 columns, but obviously the code forcing the shop to display 2 columns is affecting this. Is there a way I can separate the two?
https://eb-motorsport.com/shop/
https://eb-motorsport.com/shop/?swoof=1&pa_model=911-1965&pa_parts=bodywork
Hi there,
I'm not sure where that code is coming from - it's not something from the theme.
If it's the default WooCommerce shop page then there is a customizer option for that:
https://docs.generatepress.com/article/woocommerce-overview/#shop
Hi,
Sorry, I don't think you understood my question, I've entered the code in fuctions.php so that the main shop page displays 2 columns.
The customizer option only allows me to change the number of columns on all Woocommerce pages. I want to specify which types of Woocommerce pages show different amounts of columns. So I want the main shop page to show 2 columns, but the product search results page to show 4 columns.
Could you get this escalated to the developer, please?
Hi there,
Any chance you can remove the coming soon page so I can take a look?
Let me know :)