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

Menu doesn't return Product Categories added to WordPress menus #621

Open
haghanihakimi opened this issue Oct 28, 2022 · 0 comments
Open

Comments

@haghanihakimi
Copy link

  • Corcel Version: ^6.0
  • Framework Name & Version: Laravel ^9.19
  • PHP Version: ^8.0.2
  • Database Driver & Version: MySQLi - mysqlnd8.1.10

Description:

I'm trying to get "Product Categories" I added to the new menu. So, I created a menu and named it "newnavmenu". Instead of adding Pages, I want to add "Product categories" that I created in WooCommerce Categories.
Now, when I loop through items, the instance() method returns null and there is not specific information about menu items. I can see basic information about newnavmenu itself but nothing related to "Product categories" items I added before.

Steps To Reproduce:

So basically I do exactly what I found in documentation:

Route::get('/', function () {
    $menu = Menu::slug('newnavmenu')->first()->items;

    return view('welcome', compact(
        'menu'
    ));
});

And I try to loop through items in blade file:

@foreach ($menu as $item)
            {{$item->instance()}}
@endforeach

Even if I return $item without insance() method, none of categories is available:

@foreach ($menu as $item)
            {{$item)}}
@endforeach

How do I return "Product Categories" I added to new created menu? Anyone can help please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant