How do I use wc() in woocommerce?
as what the doc in your link says. 'prevent the need to use globals'. An example would be like this...
code using global.
global $woocommerce;$customer_country = $woocommerce->customer->get_country();
code not using global
$customer_country = WC()->customer->get_country(); // some servers may not like like this... best is to use variables like $foo = WC(); then use $foo->customer->get_country()...
How to use WC() ? start here...
WC() is just a function that returns an instance of the woocommerce class.
1) make sure you include the reference to the file where the function is located (see how to do that here) :
include_once WP_PLUGIN_DIR .'/woocommerce/woocommerce.php';
2) once you have that you can just add a local variable pointing to the current woocommerce instance:
$myWC = WC();$myWC->cart->calculate_fees();