WC_Shipping_Method::get_rate_id
Returns a rate ID based on this methods ID and instance, with an optional suffix if distinguishing between multiple rates.
Method of the class: WC_Shipping_Method{}
No Hooks.
Returns
String.
Usage
$WC_Shipping_Method = new WC_Shipping_Method(); $WC_Shipping_Method->get_rate_id( $suffix );
- $suffix(string)
- Suffix.
Default:''
Changelog
| Since 2.6.0 | Introduced. |
WC_Shipping_Method::get_rate_id() WC Shipping Method::get rate id code WC 10.7.0
public function get_rate_id( $suffix = '' ) {
$rate_id = array( $this->id );
if ( $this->instance_id ) {
$rate_id[] = $this->instance_id;
}
if ( $suffix ) {
$rate_id[] = $suffix;
}
return implode( ':', $rate_id );
}