# Number and Columns of Upsell Products

> Controls how many "You may also like" upsell products appear on product pages and in how many columns.

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

## Code

```php
add_filter( 'woocommerce_upsell_display_args', function ( $args ) {
    $args['posts_per_page'] = 3; // How many upsells to show.
    $args['columns']        = 3; // Columns.

    return $args;
} );
```

## Notes

Set $limit to 0 to show all upsells.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Number and Columns of Upsell Products" 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/
