godaddy-wordpress / godaddy-wordpress/go

Go theme bug: How to change number of columns and rows in Shop?

Open
#911 0 comments 0 reactions 0 assignees View on GitHub
[Type] Bug
Dominant language
PHP
Stars
338
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Hi,

Hoping someone can help! I've trawled the internet for hours with this one and trialled a few workarounds with no luck...

In the Go Theme Woocommerce Shop page for [sudsandbuds.co.uk/shop](url), there are always only 3 columns and 3 rows, no matter what number I enter in the box at the end of this path: 'Dashboard - Appearance - Customise - WooCommerce - Products Catalogue - Products per row'

I'm trying to get 4 columns and 4 rows. I'll settle for 4 columns and 3 rows but I can't seem to change the amount of either rows or columns.

Here's a screenshot of my shop with the 3 columns:

![image](https://github.com/godaddy-wordpress/go/assets/133355997/a16adafd-d1a9-4d8a-b8cb-b40cc3f125c2)

Weirdly, the shop displays 4 columns for my two subcategories ('topped soaps' and 'smooth soaps'):

![image](https://github.com/godaddy-wordpress/go/assets/133355997/0f539020-d3fc-421d-906a-eaf23ae768f1)

I've created a child theme (parent: 'Go') and entered code via 'Appearance - Theme file editor'. I've also entered code via 'Snippets - Add New' as well as directly to the Go theme itself via 'Appearance - 'Theme file editor'. None of the approaches work. Here are 5 of the codes I've trialled:

----------------------------------------------------------
```
// Change the Number of Columns Displayed Per Page
add_filter( 'loop_shop_columns', 'lw_loop_shop_columns' );
function lw_loop_shop_columns( $columns ) {
$columns = 4;
return $columns;
}
```
----------------------------------------------------------
```css
@media (min-width: 768px) {
ul.products.columns-4 li.product {
width: 25%;
}
}

```
----------------------------------------------------------
```php
// Change number of products per row to 4
add_filter('loop_shop_columns', 'custom_loop_columns', 999);
function custom_loop_columns() {
return 4; // Change this number to the desired number of columns
}
```
----------------------------------------------------------
```
add_filter('loop_shop_columns', 'woo_loop_columns', 999);
if (!function_exists('woo_loop_columns')) {
function woo_loop_columns() {
return 4; // 4 products per row
}
}
```
----------------------------------------------------------
```
}
// change number of columns
add_filter( 'loop_shop_per_page', 'new_loop_col_shop_per_page', 20 );
function new_loop_col_shop_per_page( $cols ) {
// Return the number of products you wanna show per page.
$cols = 3;
return $cols;
}
```
----------------------------------------------------------
Any suggestions? I'm lost with this!

Best wishes
Maya

**Priority** (select one):
- [x] Medium - Doesn't work as expected

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.