Skip to content

[00] Subset Search, User guide

WooCommerce, Polylang and WPML

How Subset Search indexes WooCommerce products, keeps hidden products out of results, and searches one language at a time with Polylang or WPML.

Subset Search works with WooCommerce, Polylang and WPML without any setup. Each integration turns itself on when that plugin is active and does nothing otherwise.

WooCommerce

Products are a public post type, so they’re indexed like posts, with their categories and tags. With WooCommerce active, Subset Search also:

  • indexes each product’s SKU, so a search for WM042 finds the product with that SKU;
  • indexes product attributes such as colour and size, which WooCommerce registers as taxonomies that aren’t public, unless you’ve listed the taxonomies to index on the Index tab;
  • leaves out of the results any product whose Catalog visibility is Shop only or Hidden, as WooCommerce’s own product search does;
  • leaves out products that are out of stock when Hide out of stock items from the catalog is ticked under WooCommerce → Settings → Products → Inventory.

Hidden products still show up in admin searches when you’ve turned on Admin search, so you can find them on the Products screen.

To rank products above posts that match as well, give the product post type a weight above 1 under Post type weights on the Search tab. To index more product fields, add their meta keys under Custom fields on the Index tab.

Polylang and WPML

Each post is indexed with its language, and a search finds the posts in the language the visitor is browsing, plus any posts that have no language. A French visitor searching your French pages doesn’t get English results. In wp-admin, searches follow the language chosen in the admin bar, and choosing all languages searches every one.

The REST API’s search route uses the current language too, when Polylang or WPML has set one for the request. When neither has, it searches every language.

If you add Polylang or WPML to a site that’s already indexed, the posts in the index don’t have their languages yet. The Index tab asks for a rebuild the first time you open wp-admin after activating it. Click Start reindex, and each post gets its language as it’s indexed again.

Stopwords and stemming follow your site’s language setting, not each post’s language. On a site whose main language is English, every language is stemmed with the English stemmer, which can merge a few unrelated words in other languages. Check your other languages’ results in the Tester.

WPML isn’t on WordPress.org, so it’s supported through its documented hooks and isn’t part of our automated tests. Polylang is tested against its current release.