Thank you very much, i’ll wait for the next update.
For now, as a temporary solution, I’ve added the wallet to menus dynamically, with a check; if primary at the end, if handheld at the 2nd position. About the icon, i couldn’t figure its css, i tried the unicode with awesomfont css and i’ve found that it’s a user profile icon, not a wallet icon.
// Add mini-wallet to primary and handheld menus
function new_nav_menu_items($items, $args) {
if (!function_exists('woo_wallet') || !is_user_logged_in()) {
return $items;
}
$title = __('Current wallet balance', 'woo-wallet');
$mini_wallet = '<li id="menu-item-4661" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-4661 focus"><a style="color:#FFFFFF;" href="' . esc_url(wc_get_account_endpoint_url(get_option('woocommerce_woo_wallet_endpoint', 'woo-wallet'))) . '" title="' . $title . '"><i class="fas fa-wallet"></i> ';
$mini_wallet .= woo_wallet()->wallet->get_wallet_balance($user_id);
$mini_wallet .= '</a></li>';
if($args->theme_location == 'primary')
{
// add the mini wallet link to the end of the menu
$items = $items . $mini_wallet;
}
else if($args->theme_location == 'handheld')
{
// add the mini wallet link to the second plage of the menu
$items_array = array();
while ( false !== ( $item_pos = strpos ( $items, '<li', 2 ) ) ) // Add the position where the menu item is placed
{
$items_array[] = substr($items, 0, $item_pos);
$items = substr($items, $item_pos);
}
$items_array[] = $items;
array_splice($items_array, 1, 0, $mini_wallet); // insert custom item after 1th item one
$items = implode('', $items_array);
}
return $items;
}
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items', 10, 2);
I appreciate if you could add options to control mini-wallet’s position in different available menus in the next update/release.