Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation-related code is causing deprecation warnings in debug log #674

Closed
2 tasks
mattsherman opened this issue Sep 7, 2024 · 3 comments · Fixed by #685
Closed
2 tasks

Navigation-related code is causing deprecation warnings in debug log #674

mattsherman opened this issue Sep 7, 2024 · 3 comments · Fixed by #685
Assignees
Labels
type: bug The issue is a confirmed bug. type: technical debt This issue/PR represents/solves the technical debt of the project.

Comments

@mattsherman
Copy link

Describe the bug

The Navigation feature has been removed from WooCommerce and the related code will be removed in the future. Currently, deprecation warnings are being logged whenever an admin page is rendered:

Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_plugin_item is deprecated since 9.3 with no alternative. Navigation classes will be removed in WooCommerce 9.4
Automattic\WooCommerce\Admin\Features\Navigation\Screen::register_post_type is deprecated since 9.3 with no alternative. Navigation classes will be removed in WooCommerce 9.4

This is due to the following code:

/**
* Register the navigation items in the WooCommerce navigation.
*
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.12
*/
public static function register_navigation_items() {
if (
! class_exists( '\Automattic\WooCommerce\Admin\Features\Navigation\Menu' ) ||
! class_exists( '\Automattic\WooCommerce\Admin\Features\Navigation\Screen' )
) {
return;
}
$subscription_items = Menu::get_post_type_items(
'shop_subscription',
array(
'title' => __( 'Subscriptions', 'woocommerce-subscriptions' ),
)
);
Menu::add_plugin_item( $subscription_items['all'] );
Screen::register_post_type( 'shop_subscription' );
}

To Reproduce

  1. Activate WooCommerce Subscriptions
  2. Load an admin page
  3. Note that deprecation messages are in debug log

Expected behavior

Navigation-related code will be removed and no deprecation warnings will be logged.

Actual behavior

Deprecation warnings are logged.

Product impact

  • Does this issue affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
  • Does this issue affect WooCommerce Payments? yes/no/tbc, add issue ref

Additional context

@mattsherman mattsherman added type: bug The issue is a confirmed bug. type: technical debt This issue/PR represents/solves the technical debt of the project. labels Sep 7, 2024
@chrism245
Copy link

8729143-zen

@nicdwilson
Copy link

8731994-zd-a8c

@shrutimoorthy
Copy link

8732890-zen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug The issue is a confirmed bug. type: technical debt This issue/PR represents/solves the technical debt of the project.
Projects
None yet
5 participants