Get a fast, conversion-focused WooCommerce theme in 2024. Switch to Shoptimizer.

Home Documentation Shoptimizer Shop and Categories Display only a ‘Primary Product Category’

Display only a ‘Primary Product Category’

Within Shoptimizer’s ‘Product cards’ (on your catalog or product listings pages) there is an option by default to display the product categories within which the item belongs. If the item is within say two categories, this will typically look fine. But it can look unwieldy and messy if it five or six categories are displayed in this area.

It may be nice to show only a ‘Primary product category’ in this space.

WordPress includes a ‘Primary category’ setting for Blog post categories. But this core functionality is missing within WooCommerce’s product categories.

1. Install Yoast, Rank Math, or AIOSEO

Popular SEO plugins Yoast SEORank Math and AIOSEO include this functionality. Install one of these. You could also separately check out our Rank Math review.

Now, when you edit an item’s product categories you’ll be able to set a Primary product category or term.

2. Add a code snippet

Next, within your child theme’s functions.php file or via the Code Snippets plugin you’ll need to include a custom function.

If using Yoast SEO:

If using Rank Math:

Add this snippet to your child theme’s functions.php file or via the Code Snippets plugin.

If using AIOSEO:

Add this snippet to your child theme’s functions.php file or via the Code Snippets plugin.

$50
Off

Do you want a whopping $50 off Shoptimizer for WooCommerce?

Click the button below to get Shoptimizer for only $49. (Regular price: $99).
This is a special launch offer for today only.
Get it before it is gone!