Feature Deprecation: WooCommerce Navigation

In late 2020, WooCommerce introduced a new Navigation feature, which was only accessible by manually setting an option. However, this feature was never fully activated and saw limited adoption. While it was officially removed in WooCommerce 9.3, the associated classes were deprecated but retained for backward compatibility. Despite the limited use, many extensions updated their codebases to integrate with the Navigation feature. This post is for developers who may have implemented code changes using these classes.

The Navigation feature was ultimately dropped in favor of a native WordPress Core solution, which will provide a more unified approach to handling navigation across WordPress and WooCommerce. This shift will allow developers to align their extensions with the broader WordPress ecosystem, ensuring better long-term support and consistency.

The deprecated Navigation classes will be completely removed in WooCommerce 9.5 and replaced with aliased deprecation classes to avoid unnecessary fatals. Below is a guide to safely remove any code that registers for the Navigation feature.

The following classes will be officially deprecated in WooCommerce 9.5:

  • Automattic\WooCommerce\Admin\Features\Navigation
  • Automattic\WooCommerce\Admin\Features\Navigation\Menu
  • Automattic\WooCommerce\Admin\Features\Navigation\Screen
  • Automattic\WooCommerce\Admin\Features\Navigation\CoreMenu

If your code calls any methods from these classes execution should be prevented with condition checks to avoid fatal errors, as seen below. It’s essential that these checks are present if any remaining code depends on these methods.

if (
    ! method_exists( Screen::class, 'register_post_type' ) ||
    ! method_exists( Menu::class, 'add_plugin_item' ) ||
    ! method_exists( Menu::class, 'add_plugin_category' ) ||
    ! Features::is_enabled( 'navigation' )
) {
    return;
}

Finally, reviewing the original registration post for the Navigation feature can help identify any code additions that may still exist in your codebase and should be removed or refactored.


Keep yourself in the loop!

This field is hidden when viewing the form
This field is hidden when viewing the form
This field is hidden when viewing the form


Leave a Reply

Your email address will not be published. Required fields are marked *