Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add WooCommerce mini cart to primary nav Genesis
/**
* Add WooCommerce cart to primary navigation Genesis
* @author Frank Schrijvers
* @link https://www.wpstud.io/add-woocommerce-cart-to-genesis-navigation/
*/
if ( class_exists( 'WooCommerce' ) ) {
add_action( 'genesis_header_right', 'wpstudio_add_cart' );
function wpstudio_add_cart() {
echo '<div class="mini-cart">';
echo '<a href="' . WC()->cart->get_cart_url() .'"title="View your shopping cart">'. WC()->cart->get_cart_total(). '</a>';
echo '<span class="cart-count">' . WC()->cart->cart_contents_count . '</span></div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment