Display Total Product Sold Quantity to WooCommerce Product Page

# This is post #4 of 31 in the challenge “31 Ways to Customize WooCommerce

This snippet code show you how to display total product sold quantity under product title at WooCommerce product page.

Currently your customers have no idea how many quantity or downloads have been ordered from your WooCommerce site. So in order to apply this change, you can add below code into your theme functions.php.
Continue reading

Remove ‘(Free)’ label text for WooCommerce Shipping and Handling

# This is post #2 of 31 in the challenge “31 Ways to Customize WooCommerce

This snippet show you how to remove (Free) label text for WooCommerce Shipping and Handling section in WooCommerce checkout and cart page.

Currently if the cost of your shipping method is $0, it will display text “(Free)”. But sometimes there is case where you have an option of shipping which is paid by the customer upon pickup or receival, so the value of the shipping for store owner is 0 but is not FREE for customer.

Before

(Free) text at Shipping and Handling row if shipping cost is 0

(Free) text at Shipping and Handling row if shipping cost is 0

Continue reading

How to Add a 5% Surcharge to Your WooCommerce Cart / Checkout

# This is post #1 of 31 in the challenge “31 Ways to Customize WooCommerce

This snippet mostly explained how you can add a 5% surcharge to WooCommerce cart / checkout based on conditions.

Option 1 (Add 5% surcharge for all) :

add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge_all' );

function woocommerce_custom_surcharge_all() {
  global $woocommerce;

  if ( is_admin() && ! defined( 'DOING_AJAX' ) )
    return;

  $percentage = 0.05; //change this value for surcharge percentage
  $surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage;

  $woocommerce->cart->add_fee( 'Surcharge (5%)', $surcharge, true, 'standard' );
}

Continue reading