Created
December 18, 2014 15:09
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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