Add checkout & cart buttons to the flyout

One of the requests we commonly get is to add a checkout link to the menu cart pro flyout. Fortunately, we have a filter in place that will allow you to do that! If you’re using WooCommerce just copy and paste the code below into your theme’s functions.php file. If you don’t know how to use filters read this article.

You can then style that button to your liking by using the li.cart-link .button class. If you need help adjusting it, we can do that for a small customization fee that you can purchase from our shop.

Note that you may need to close and reopen the browser tab before the changes take effect.

/**
* Replace regular flyout cart link to two buttons
*/
add_filter( 'wpmenucart_cart_link_item', 'wpmenucart_cart_checkout_buttons', 10, 1 );
function wpmenucart_cart_checkout_buttons($cart_link_item) {
 // make buttons
 $checkout_button = sprintf('<a href="%s" class="button">Checkout</a>', wc_get_checkout_url());
 $cart_button = sprintf('<a href="%s" class="button">View Cart</a>', wc_get_cart_url());
 
 // menu item
 $cart_link_item = sprintf('<li class="menu-item wpmenucart-submenu-item cart-link">%s%s</li>', $checkout_button, $cart_button);
 
 return $cart_link_item;
}