# Change the Number of Product Gallery Thumbnails per Row

> Sets how many thumbnails appear in each row below the main product image on product pages.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, gallery, product-page
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-gallery-thumbnail-columns/

## Code

```php
add_filter( 'woocommerce_product_thumbnails_columns', function () {
    return 5; // Thumbnails per row.
} );
```

## Notes

Some themes override the gallery layout with their own CSS; adjust there if the change does not show.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Change the Number of Product Gallery Thumbnails per Row" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
