I am using WordPress 4.3.1, Woocommerce 2.4.7 and the theme storefront 1.5.1.
I want to change the "site-header-cart" in the header, that displays the current price of the cart along the amount of items in the cart, to only show the number of items:
<span class="amount">463,33 €</span>
<span class="count">7 items</span>
Should be:
<span class="count">7</span>
Whenever I make changes to template-tags.php only changes outside of the
<a class="cart-contents" ...>
...
</a>
are being displayed. Whenever I try to change something inside the href the unchanged original will show up:
if ( ! function_exists( 'storefront_cart_link' ) ) {
function storefront_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" title="<?php _e( 'View your shopping cart', 'storefront' ); ?>">
<span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) );?></span>
</a>
<?php
}
}
Whats going on, can anyone help me ?
I had the same Issue. The fact is, that you have to make a operation on the cart like add a item or empty the cart to get your changes visible. Another option is clearing the sessionStorage like Loque described.
1. Add code to your custom functions.php
if ( ! function_exists( 'storefront_cart_link' ) ) {
function storefront_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" title="<?php _e( 'View your shopping cart', 'storefront' ); ?>">
<span class="count"><?php echo WC()->cart->get_cart_contents_count();?></span>
</a>
<?php
}
}
2. Do a operation on the cart or clear the sessionStorage in Console:
sessionStorage.removeItem('wc_fragments')
3. Refresh your Browser --> very Important
Before:
<span class="count">1 items</span>
After:
<span class="count">1</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With