---
title: "Products Compare developer reference"
url: "https://kestrelwp.com/docs/products-compare-developer-reference/"
description: "Templates and filters for changing the Products Compare page, limits and rows."
published: "2026-10-06T20:26:57+00:00"
modified: "2026-10-06T20:26:57+00:00"
---

Products Compare has no settings screen, so its compare page address, product limit, list lifetime and rows are changed with two templates and seven filters. Add filters in a code snippets plugin or your child theme’s `functions.php`. Customizations like these aren’t covered by support, so test them on a staging site first.

For what the plugin does without any code, see [Get started with Products Compare](/docs/get-started-with-products-compare/).

## When you’d use this

- Give the compare page a different address or title.
- Let shoppers compare more or fewer than five products.
- Keep the compare list for longer or shorter than 7 days.
- Hide rows, or reorder them, on the compare page.
- Change the compare page’s or widget’s markup beyond what CSS can do.

## Template overrides

Two templates in the plugin’s `templates` folder control what shoppers see:

- `products-compare-page-html.php`: the compare page.
- `content-widget-products-compare.php`: the Products Compare for WooCommerce widget.

Copy the file into your child theme, either into its `woocommerce` folder or its root folder, and edit the copy. WordPress loads your theme’s copy instead of the plugin’s, so plugin updates don’t overwrite it. After an update, compare your copy with the plugin’s template in case it changed.

**WooCommerce » Status** has a **Products Compare** section whose **Template Overrides** row lists a copy of the compare page template in your theme’s root folder.

## Filters

### woocommerce\_products\_compare\_end\_point

Filters the compare page’s address, `products-compare` by default. The page sits at the root of your site, so `my-comparison` gives `https://example.com/my-comparison/`. After changing it, go to **Settings » Permalinks** and click **Save Changes** so WordPress picks up the new address.

### woocommerce\_products\_compare\_page\_title

Filters the compare page’s title, "Products Compare" by default. It’s used for the browser tab, WooCommerce’s breadcrumb and Yoast SEO’s title and breadcrumb.

### woocommerce\_products\_compare\_max\_products

Filters how many products a shopper can compare at once. Default `5`. The alert shoppers see when they reach it uses the new number.

```
add_filter( 'woocommerce_products_compare_max_products', function () {
	return 4;
} );
```

### woocommerce\_products\_compare\_cookie\_expiry

Filters how many days the compare list is kept in the shopper’s browser. Default `7`.

### woocommerce\_products\_compare\_compare\_button

Filters the HTML of the **Compare** checkbox and the icon link to the compare page. It receives the HTML, the product ID and the checkbox’s `checked` attribute (empty when the product isn’t in the list). Keep the `woocommerce-products-compare-compare-button` class on the wrapper and the `data-product-id` attribute on the checkbox, because the plugin’s script relies on them.

### woocommerce\_products\_compare\_selected\_products

Filters the products in the shopper’s compare list. The compare page, the widget and the checkboxes’ ticked state all use it.

### woocommerce\_products\_compare\_meta\_headers

Filters the rows below the price on the compare page. It receives an array of row keys in display order: `stock`, `sku`, `description`, then each attribute’s name (for example `pa_color`). The **Ratings** and **Price** rows aren’t part of it.

To hide the SKU row:

```
add_filter( 'woocommerce_products_compare_meta_headers', function ( $headers ) {
	return array_values( array_diff( $headers, array( 'sku' ) ) );
} );
```

## Keep learning

- [Get started with Products Compare](/docs/get-started-with-products-compare/) (where the checkbox appears, the compare page and common issues)
- [How to add custom CSS to your site](/docs/how-to-add-custom-css-to-your-site/) (styling without template changes)
- [Changing text in a plugin](/docs/changing-text-in-a-plugin/) (rewording labels without code)
