Add actions before/after shipping calculation

This commit is contained in:
Boro Sitnikovski 2020-05-18 21:04:13 +02:00
parent eea062f9fa
commit d1ac3731a5
1 changed files with 2 additions and 0 deletions

View File

@ -230,7 +230,9 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
public function get_rates_for_package( $package ) {
$this->rates = array();
if ( $this->is_available( $package ) && ( empty( $package['ship_via'] ) || in_array( $this->id, $package['ship_via'] ) ) ) {
do_action( 'woocommerce_before_calculate_shipping', $package, $this );
$this->calculate_shipping( $package );
do_action( 'woocommerce_after_calculate_shipping', $package, $this );
}
return $this->rates;
}