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