Hi Simion,
sorry for the late update. It works perfectly after adding the above code to functions.php! Thanks for your support, much appreciated!
Lets say I don’t want to show that 1 product per row on mobile, but keep the default 2. Is there an easy way to edit the total number of products per page for mobile so that there’s no single product on the last row of each page?
Thanks!
Thanks Simion! It actually works this way. The thing is – always when opening a woocommerce category page or going to the next page, it flashes initially the default 2 products/row, and then shows only one, bigger product image, according to the new css added for phones. It’s not quite the optimal solution for the case. Is there a way to change the number of products per page for phones?
Having in mind that I already have this in functions.php:
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 15;
return $cols;
}
// Change number or products per row to 3
add_filter(‘loop_shop_columns’, ‘loop_columns’);
if (!function_exists(‘loop_columns’)) {
function loop_columns() {
return 3; // 3 products per row
}
}
After doing some tests, it turns out that the last suggested code:
.woocommerce .columns-3 ul.products[class*=columns-] li.product, .woocommerce-page ul.products[class*=columns-] li.product {
width: 100%;
}
changes the design of the desktop version too. It shows 1 product per row on both mobile and desktop.
It should keep showing 3 products per row on desktop, which was achieved using this code:
// Change number or products per row to 3
add_filter(‘loop_shop_columns’, ‘loop_columns’);
if (!function_exists(‘loop_columns’)) {
function loop_columns() {
return 3; // 3 products per row
}
}
Changing the total number of products per page for mobile would also be a solution. This way we can keep showing 2 products per row, just need to define somehow a total number of lets say 16 products so that there no single product left at the end of each page. Any ideas how to achieve?
Works perfectly! Thanks a lot Simion!
Hi Catalin,
I’m using a child theme with custom functions.php where the following was added in order to show 3 products per row + sidebar on desktop instead of the default 4:
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 15;
return $cols;
}
// Change number or products per row to 3
add_filter(‘loop_shop_columns’, ‘loop_columns’);
if (!function_exists(‘loop_columns’)) {
function loop_columns() {
return 3; // 3 products per row
}
}
The thing is – the number of products per page on mobile also changed to 15 and so the last row on every category page contains only one product.
For example: On desktop I had 4 products per row (I think that’s by default) and was able to successfully change it to 3 products per row using the suggested code in functions.php. I changed the total number of products per page to 15 (3×5).
But on mobile, there are 2 products per row by default. After changing the total number of products per page, on mobile there’s 1 product on the last row of each page. This doesn’t look nice.
Any ideas how to change the total number of products per page on mobile or how to switch from 2 products per row to 1 product/row on mobile? Both are possible solutions.
Thanks!
This solution works only for desktop: https://wordpress.org/plugins/woocommerce-products-per-page/
How about changing the number of products per page on mobile?
That way I lose the sidebar on archive pages too, which is not what I want.
I have the same problem. My main shop page (with woocommerce products) got broken after the most recent theme update.
I never had a sidebar on this page, but now there’s a place reserved for a sidebar.
Already tried to disable all plugins one by one – nothing changes
Now everything is updated on the main theme incl. plugins, but the child theme still shows Newspaper 7 and the site isn’t working. Please advice!
I downloaded the latest version and installed it, but visual composer isn’t updated to the latest version. My child theme is still showing Newspaper 7 and the site isn’t working.
Note: It isn’t auto updated to 8.1. It is still on 8. Still not working
Cheers for that, it works! Thank you Simion!
Thanks, Simion, much appreciated!
It works, and it fixes the issue even when 4 products per row are set, but only on desktop. On a mobile the products are displayed like this – 1 product per row and diagonal (chess layout).
As always – big thanks, Simion! It works on my end.
Cheers
Hi Bogdan,
In fact, all already made redirects function properly. If I make a new redirect, it works properly.
If you put the test link directly in your browser url field and load it, you will be properly redirected. But when you click the tag element, you aren’t redirected.
The link I gave you for tests is now correctly redirected using 301 redirect to the desired url. Can you deny it?
I don’t think that the problem is with the plugin. I really hoped to be able to fix this with your support.
I made a lot of custom redirects during the years using the Redirection plugin.
I’m afraid that I will get in a trouble if I remove it….
Thanks
Hi Catalin,
there’s no caching plugin or similar. Did you test with online redirect checker? What is the result? When you click on the tag and the page loads, then please click within the browser url filed and press Enter. What happens?
Thanks
Hi Catalin,
could you please try once again to recreate the issue?
I made a further redirection and now an online redirect checker should show a 301 redirect. However I’m not redirected when I click on the tag in question from the post in question. Please check again and let me know if you can help.
Thanks
Hi Bogdan,
I sent an email with login details.
Thanks
Hi Catalin,
You say that you can’t recreate my issue – So you mean that when you click on the tag link you are properly redirected?
Thanks
Hi Catalin,
I sent an email with login details.
Thank you