Skip to content

Instantly share code, notes, and snippets.

@JoelBeasley
Forked from kloon/functions.php
Created November 23, 2013 18:38
Show Gist options
  • Save JoelBeasley/7618309 to your computer and use it in GitHub Desktop.
Save JoelBeasley/7618309 to your computer and use it in GitHub Desktop.
<?php
remove_action( 'woo_nav_inside', 'woo_add_nav_cart_link' );
add_filter( 'wp_nav_menu_items', 'woo_move_cart_to_top_nav', 10, 2 );
function woo_move_cart_to_top_nav( $items, $args ) {
global $woocommerce;
if ( $args->menu_id == 'top-nav' ) {
$items .= '<li><a class="cart-contents" href="'.esc_url( $woocommerce->cart->get_cart_url() ).'" title="'.esc_attr_e( 'View your shopping cart', 'woothemes' ).'">'.sprintf( _n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes' ), $woocommerce->cart->cart_contents_count ).' - '.$woocommerce->cart->get_cart_total().'</a></li>';
}
return $items;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment