Replace Woocommerce Cart

Can you help me to replace this “woomenucart-menu-item” in the navbar with a “Donation” button?
I found the code in “extra.php” but really don’t know how to replace it with a “Donation” button. Coding is not my strong area.

Hi @adrian200065,

I hope you are well today and thank you for your question.

You can replace the “woomenucart-menu-item” in the navbar with a “Donation” button by using the attached small plugin that contains the following custom code.

function alter_unite_menu(){
	remove_filter('wp_nav_menu_items','unite_woocommerce_menucart');
	add_filter('wp_nav_menu_items','custom_unite_woocommerce_menucart', 10, 2);
}
add_action('init', 'alter_unite_menu');

function custom_unite_woocommerce_menucart($menu, $args) {

	ob_start();
	$cart_contents = 'Donation Button';

     $menu_item = '</ul><ul class="nav navbar-nav navbar-right"><li><a class="woomenucart-menu-item" href="#" title="'. __('Donation', 'unite') .'">';
      $menu_item .= $cart_contents;
      $menu_item .= '</a></li></ul>';

    echo $menu_item;
  $social = ob_get_clean();
  return $menu . $social;

}

You have to add the Donation button code in place of ‘Donation Button’ in the above code.

Best Regards,
Movin

Thank you, Movin.
That was exactly what I want to do.

You are always welcome here :slight_smile: