Last active
January 30, 2018 03:58
-
-
Save kamalinfo/14b529235a4eefb5afec1936af9f1e28 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
//functions php | |
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' ); | |
function woocommerce_header_add_to_cart_fragment( $fragments ) { | |
global $woocommerce; | |
ob_start(); | |
?> | |
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php esc_html_e('View your shopping cart', 'text_domain'); ?>"> | |
<span class="htc__qua"><?php echo esc_html( $woocommerce->cart->cart_contents_count ); ?></span> | |
</a> | |
<?php | |
$fragments['a.cart-contents'] = ob_get_clean(); | |
return $fragments; | |
} | |
//where need | |
global $woocommerce; | |
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'text_domain'); ?>"> | |
<span class="htc__qua"><?php echo esc_html( $woocommerce->cart->cart_contents_count ); ?></span></a> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment