Remove empty button that appears in Flatsome themes

READ FIRST: This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven't done this before, adding this code in wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help!

Some themes such as Flatsome are not following WooCommerce standard regarding tabs, so it happens to make logout button empty, if this happens to you as well (like on the image below), read below for the fix.

You need to add this code to your functions.php file:

// Remove extra empty button for WPGens Refer a friend
add_action('wp','wpgens_custom_account_tabs');
function wpgens_custom_account_tabs(){
	$gens_plugin = WPGens_RAF::instance();
	remove_filter( 'woocommerce_account_menu_items', array($gens_plugin->my_account,'gens_account_menu_item'),10);
	add_filter( 'woocommerce_account_menu_items', 'wpgens_account_menu_item',10,1 );  
}
function wpgens_account_menu_item( $items ) {
    $items['myreferrals'] = __( 'Refer a Friend', 'gens-raf' );
    return $items;
}

And that's it.

Still need help? Contact Us Contact Us