woocommerce_shipping_rate_cost
Filter the shipping rate cost.
Usage
add_filter( 'woocommerce_shipping_rate_cost', 'wp_kama_woocommerce_shipping_rate_cost_filter', 10, 2 );
/**
* Function for `woocommerce_shipping_rate_cost` filter-hook.
*
* @param string $cost The shipping rate cost.
* @param WC_Shipping_Rate $that The shipping rate object.
*
* @return string
*/
function wp_kama_woocommerce_shipping_rate_cost_filter( $cost, $that ){
// filter...
return $cost;
}
- $cost(string)
- The shipping rate cost.
- $that(WC_Shipping_Rate)
- The shipping rate object.
Changelog
| Since 3.2.0 | Introduced. |
Where the hook is called
woocommerce_shipping_rate_cost
woocommerce/includes/class-wc-shipping-rate.php 302
return apply_filters( 'woocommerce_shipping_rate_cost', $this->data['cost'], $this );