In a recent Business Bloomer Club Slack thread, a question arose about customizing WooCommerce breadcrumbs.
A client had created unique landing pages for each product category outside WooCommerce, and they wanted the breadcrumbs on product pages to link to these new landing pages rather than WooCommerce’s standard category pages.
Here’s a breakdown of potential solutions.
Solution #1: Edit WooCommerce Breadcrumbs to Link to Custom URLs
One approach is to modify the breadcrumb structure itself, linking it to the custom landing page URLs rather than WooCommerce’s default category pages. A custom filter for WooCommerce breadcrumbs can achieve this, replacing /category/
with the client’s preferred URL structure.
Solution #2: Use Redirects to Point from WooCommerce Categories to Landing Pages
Another option is to set up redirects from each default category URL (/category/woo-category-name
) to the custom landing page (/custom-category-name
). This avoids altering WooCommerce’s structure and provides a seamless user experience by rerouting users to the correct landing pages.
Option for Integrating Custom Landing Page Content
As an alternative, consider integrating the landing page content directly into the WooCommerce category pages. The client can use their page builder to save the landing page as a shortcode and add it to the category description field, displaying the content without disrupting WooCommerce’s structure.
However, as noted, WooCommerce will still show the default product loop below this custom content. To disable the product display, try the following:
add_action('woocommerce_before_main_content', function() {
if (is_product_category()) {
remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10);
}
}, 20);
Or, you could use a template override in archive-product.php
to fully control the category page layout.
Conclusion
While customizing WooCommerce breadcrumbs is possible, integrating the custom landing pages directly into category pages with shortcode inserts and hiding the product loop may offer a simpler, more maintainable solution. This approach keeps the site structure cleaner and leverages WooCommerce’s built-in SEO benefits for category pages.