Updated to work on both 1.6 and 2.x WooCommerce versions.