Skip to content

Instantly share code, notes, and snippets.

@Spreeuw
Created December 18, 2014 15:09
Show Gist options
  • Save Spreeuw/90d36f7350a77807de88 to your computer and use it in GitHub Desktop.
Save Spreeuw/90d36f7350a77807de88 to your computer and use it in GitHub Desktop.
Replace Menu Cart Pro link item with two buttons linking to the cart and checkout #wpovernight #menucart #menucartpro
add_filter( 'wpmenucart_cart_link_item', 'wpmenucart_cart_checkout_buttons', 10, 1 );
function wpmenucart_cart_checkout_buttons($cart_link_item) {
global $woocommerce;
// get urls
$checkout_url = $woocommerce->cart->get_checkout_url();
$cart_url = $woocommerce->cart->get_cart_url();
// make buttons
$checkout_button = sprintf('<a href="%s">Checkout</a>', $checkout_url);
$cart_button = sprintf('<a href="%s">View Cart</a>', $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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment