Categories
WooCommerce WordPress

Change “Add to Cart” text on single product page

<?php

function chetan_custom_cart_button_text() {

    return __( 'My Button Text', 'chetan' );

}

add_filter( 'add_to_cart_text', 'chetan_custom_cart_button_text' ); // WooCommerce < 2.1
add_filter( 'woocommerce_product_single_add_to_cart_text', 'chetan_custom_cart_button_text' ); // WooCommerce 2.1 +
Categories
WooCommerce WordPress

WooCommerce – Update number of items in cart and total after Ajax

add_filter('add_to_cart_fragments', 'chet_tips_woocommerce_header_add_to_cart_fragment');

function chet_tips_woocommerce_header_add_to_cart_fragment( $fragments ) {
  global $woocommerce;

  ob_start();

  ?>
  <span class="cart-count"><?php echo $woocommerce->cart->cart_contents_count; ?></span>
  <?php

  $fragments['span.cart-count'] = ob_get_clean();

  return $fragments;

}