Fix filter woocommerce_shipping_rate_cost backwards compatible with cart taxes #28008
This commit is contained in:
parent
581f57b8f4
commit
1075382575
|
@ -82,7 +82,13 @@ class WC_Tax {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function calc_shipping_tax( $price, $rates ) {
|
public static function calc_shipping_tax( $price, $rates ) {
|
||||||
|
// Backwards compatible from WC_Shipping_Rate::get_cost().
|
||||||
|
if ( has_filter( 'woocommerce_shipping_rate_cost' ) ) {
|
||||||
|
$rate = new WC_Shipping_Rate();
|
||||||
|
$price = $rate->get_cost();
|
||||||
|
}
|
||||||
$taxes = self::calc_exclusive_tax( $price, $rates );
|
$taxes = self::calc_exclusive_tax( $price, $rates );
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_calc_shipping_tax', $taxes, $price, $rates );
|
return apply_filters( 'woocommerce_calc_shipping_tax', $taxes, $price, $rates );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue