I am creating a custom shipping method for Woocommerce using this tutorial https://docs.woocommerce.com/document/shipping-method-api/ but I am having issues debugging. Whenever shipping methods get updated by user, Woocommerce calls calculate shipping. I have overridden this function with the following.
public function calculate_shipping( $package ) {
// This is where you'll add your rates
$rate = array(
'idea' => $this->id,
'label' => $this->title,
'cost' => '90.00',
'calc_tax' => 'per_item'
);
echo "<script>console.log('Calculating shipping');</script>";
$this->add_rate($rate);
}
In the end I have a fairly complex way of calculating the "cost" but I have no way of debugging it because that echo line produces no output in the chrome console. Any ideas what is going on here?
Any help would be much appreciated. Thank you.