Nav Menu - Use custom links & pass b_product_cat parameter

Hi there,

On my Home Page, I have created section with a query that cycles through my ‘Product Categories’. Those categories link to my Shop page using the following dynamic URL: {site_url}/shop?b_product_cat={term_id}.

I would like to achieve something similar for the nav menu containing the Product Categories. Currently, the nav menu links to: product-category\{category}\{sub-category}, which, as far as I understand, is the default behaviour.

The problem is that the search function & the filters contained in the page are not reflected in the page for latter link structure. Ideally, I would like all those to sync up. That would work if used the former link structure.

Is there any way to achieve that?

Many thanks,
Nikos.

Screenshot 2023-04-11 at 12.16.57

I suppose another way I could do this is by creating a custom menu programmatically and setting the custom link in there.

I am not sure which hook I would need to add the callback to though. Would wp_get_nav_menu_items or wp_get_nav_menu_objects work?

@timmse or @thomas would you be able to help me out with this?