Back to Tools

WooCommerce Product Sorter

Use cases

Improving default product sorting in WooCommerce Ensuring products appear in logical order based on category names

Connects to the WooCommerce REST API (wc/v3) to sort products within categories by relevancy using FuzzyWuzzy token_sort_ratio.

Compares product names against category names to calculate similarity scores.

Batch updates menu_order via API to reorder products.

Paginates the category fetch (100 per page); the product fetch is unpaginated, so around 10 products per category (the API default) are processed.

Dual timeout settings (120s send/receive).

Streamlit App

Platform

Browser-based (no installation required)

Input

WooCommerce store URL

Consumer key and consumer secret API credentials

Output

Products automatically reordered within WooCommerce categories by relevancy score. Console shows category names, product counts, and sorted listings.

Launch App View Source

Features

  • WooCommerce REST API v3 integration
  • FuzzyWuzzy token_sort_ratio scoring (ties broken alphabetically)
  • Batch POST updates for menu_order values
  • Category pagination (100 per page); products fetched one page per category (API default 10)
  • 120-second send/receive timeouts for large catalogues
  • Console output: category names, product counts, sorted listings

How to use

  1. 1 Enter WooCommerce store URL and read/write API credentials
  2. 2 Tool fetches all categories, then the first page of products per category
  3. 3 FuzzyWuzzy scores each product name against its category name
  4. 4 Batch updates menu_order live via products/batch (no dry run)
  5. 5 Set storefront sorting to Default sorting so menu_order takes effect

Frequently asked questions

Why did only some products in each category get reordered?
The product fetch does not paginate. Categories are fetched 100 per page until exhausted, but products are requested with a single call per category and no per_page parameter, and the WooCommerce REST API returns 10 items per request by default. Only that first page of products is scored and given a menu_order. Add pagination or a per_page parameter to the products request if your categories are larger.
Does this change my live store immediately?
Yes. It POSTs menu_order updates via the products/batch endpoint as it processes each category, with no dry-run or preview mode. Run it against a staging site first. The new order is only visible on the storefront when the catalogue sort option is Default sorting, which is what respects menu_order.
What happens to products in more than one category?
menu_order is a single field on the product, not a per-category value, so a product appearing in several categories gets its menu_order overwritten each time one of its categories is processed. It keeps whichever position was written last, which may not suit its other categories.
How is the relevancy score calculated?
FuzzyWuzzy token_sort_ratio between the product name and the category name, a 0 to 100 score that tokenises and sorts words before comparing, so word order does not matter. Ties are broken alphabetically by product name. It is purely lexical: a 'TIG Welding Torch' scores well in 'Welding Torches', but synonyms or model-number-only names score poorly.
What API credentials does it need?
A WooCommerce REST API consumer key and secret with Read/Write permission, created under WooCommerce > Settings > Advanced > REST API, plus your store URL. The script uses API version wc/v3 with 120-second send and receive timeouts for large catalogues.

Need something built for your business?

This tool started as bespoke client work. I build custom scripts, data pipelines, and full apps for SEO and product data problems that off-the-shelf tools don't solve.

Tell Me What You Need