Add getters for description and delivery time

This commit is contained in:
Thomas Roberts 2024-07-17 16:02:39 +01:00
parent c83c0ecbfd
commit e706f65e76
No known key found for this signature in database
GPG Key ID: 0262BEBCBE336365
1 changed files with 36 additions and 0 deletions

View File

@ -256,6 +256,42 @@ class WC_Shipping_Rate {
return apply_filters( 'woocommerce_get_shipping_tax', count( $this->taxes ) > 0 && ! WC()->customer->get_is_vat_exempt() ? (float) array_sum( $this->taxes ) : 0.0, $this );
}
/**
* Get rate description.
*
* @since 9.2.0
* @return string
*/
public function get_description() {
/**
* Filter the shipping rate description.
*
* @since 9.2.0
*
* @param string $description The current description.
* @param WC_Shipping_Rate $this The shipping rate.
*/
return apply_filters( 'woocommerce_shipping_rate_description', $this->data['description'], $this );
}
/**
* Get rate delivery time.
*
* @since 9.2.0
* @return string
*/
public function get_delivery_time() {
/**
* Filter the shipping rate delivery time.
*
* @since 9.2.0
*
* @param string $delivery_time The current description.
* @param WC_Shipping_Rate $this The shipping rate.
*/
return apply_filters( 'woocommerce_shipping_rate_delivery_time', $this->data['delivery_time'], $this );
}
/**
* Add some meta data for this rate.
*