The items in the $fragments array will replace the html contents of the element you specify as the key. In your example
$fragments['li.menu-item-type-woocommerce-cart'] = 'some html';
some html will be inserted in the DOM element <li class=”menu-item-type-woocommerce-cart”>
Here is the Javascript:
$( 'li.menu-item-type-woocommerce-cart' ).replaceWith( 'some html' );
Is there already such an element in your menu?
Related Posts:
- Why is ‘nav_menu_item_args’ filter’s $item argument empty?
- Third level navigation class
- Add a counter beside menu item label
- Displaying a Custom Avatar in WP Bootstrap Navwalker Menus in WordPress
- Dynamically exclude menu items from wp_nav_menu
- How to Add to Each Menu Link with link text to data-attr?
- Add custom classes to anchor in wp_nav_menu
- Removing link ” from ” menu for some “links” without JS
- Multi Level Bootstrap Navigation Menu in WordPress
- Determine if a navigation item has children
- Bootstrap dropdown nav pills not working with wp_nav_menu()
- Add Page ID class to nav menu items
- Links open only on new tab or window
- Bar separated navigation by extending Walker_Page
- How to Create a Custom WordPress Navigation Menu with the Code?
- how to automatically generate hierarchical menus from hierarchy of pages?
- Add sidebars to navigation menu?
- Add custom text to menu
- Menu styling for last menu item
- How to insert custom code into wp_nav_menu structure?
- Menus like a CMS
- Remove li from wp_nav_menu
- Adding post excerpt into navigation menu
- Use wp_nav_menu to display ALL pages
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- get_query_var(‘post_type’) not returning in a filter
- Prev / Next menu item
- Navigation Menus Depth for specific menus
- wp_nav_menu() with multiple Class
- add span class and i tag inside wp_nav_menu link anchor tag
- I am facing a problem with the navigation menu of my website
- Prepend to start of WordPress nav loop
- Filter for Admin Nav Menus Drop Down
- Grey out nav buttons unless is_user_logged_in()
- You do not have permission to create Navigation Menus – Twenty Twenty-Two theme
- How to approach this menu design?
- Trying to Create Menu in WordPress
- Creating a navigation menu to see where you are on your website
- How can I add text to a single nav menu item?
- Alternative to wp_get_nav_menu_items?
- Using my WordPress menu on another platform
- How Do I Add Images To Main Navigation Menu
- Add a submenu to wp_nav_menu
- Walker menu not displaying at all
- Hide menu from homepage
- remove menu items if user can’t read
- Is there a hook for nav menu item links to add custom css programatically?
- How to automatically redirect to first item of second navigation level in a multi-level menu?
- Locking in navigation labels before changing title?
- How to add columns to wordpress menu editor
- how to insert data in li tag of navigation
- How to Add support for sub-menu item description in wordpress?
- Current author archive in navigation menu
- Output Post ID for all nav_items
- Custom ul class
- Removing Submenu from Menu
- How to create menu spread over four lines including images
- Customize Widget Navigation
- Additional navigation bar in header
- Help with WordPress Custom Nav Walker
- Why is my navigation in my onepage not working?
- Navigation item – current date in url
- Hide a menu (navigation bar) on all posts
- Bootstrap Theme Migrated to WordPress
- WordPress Menu Navigation links not working
- Bootstrap Nav Walker Sub Menu Image
- Creating navigation out of specific IDs and their children?
- Where to place a svg chevron down in my custom walker?
- How to apply individual menu item’s “CSS Classes” to , not ?
- Add active class to wp_nav_menu
- Output existing wp_nav_menu with a custom walker
- how to split vertical menu into two columns using walker nav menu
- Sub-Items Not Visible in Navigation
- how to configure this type of menu
- Header lists posts instead of showing primary nav menu
- Programmatically add a Navigation menu and menu items
- Site-wide tabs at WordPress website?
- Creating custom Menu for custom theme
- How to add class and span to
- Show Child of Parent Page including all other parents
- Next/previous a-like single navigation
- Show only second level menu items? [duplicate]
- Add item ONLY to the primairy navigation
- Image menu on responsive WordPress
- wp_nav_menu: indicate by id page grandparents
- individual images as navigation design TwentyTen
- WordPress Navigation default output
- How to call either page name as the nav link or navigation title?
- How to get wordpress navigation to work
- How do I show a different secondary navigation menu for each section of my website?
- Add a navigation menu item using MySQL
- how to make a walker to this (in bootstrap, i try but not work)
- Site navigation sits unstyled for a second on page reload [closed]
- Custom navigation / menu output (walker?)
- Navigation menu displays permalinks
- Tried to hide navigation menu on one page ended up SCRAMBLING the navigation menu on another
- Add a new menu selector element into WordPress nav-menus.php
- How to add toggle-able DOM element after nav menu item?
- Primary menu item is not highlighting when page is active even though it is linked from a url with query string to pre-populate a form field
- Change color of active link to navigation menu