Search code examples
phpwordpresswoocommercehook-woocommercewoocommerce-subscriptions

WooCommerce how to get the list of my account items?


I am trying to get all the menu items under the WooCommerce My account but it returns only the default items.

This function wc_get_account_menu_items() returns array(6) { ["orders"]=> string(6) "orders" ["downloads"]=> string(9) "downloads" ["edit-address"]=> string(12) "edit-address" ["payment-methods"]=> string(15) "payment-methods" ["edit-account"]=> string(12) "edit-account" ["customer-logout"]=> string(15) "customer-logout" }

But this does not have subscriptions or an appointment menu.

I believe these were added through woocommerce_account_menu_items filter. But how can I have the current list of current menus with links?


Solution

  • echo '<pre>wc_get_account_menu_items:-';
    print_r( wc_get_account_menu_items());
    echo '</pre>';
    

    It prints all the menus.

    enter image description here