Automattic\WooCommerce\StoreApi\Schemas\V1

CartShippingRateSchema::get_rate_prop()protectedWC 1.0

Gets a prop of the rate object, if callable.

Method of the class: CartShippingRateSchema{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_rate_prop( $rate, $prop );
$rate(WC_Shipping_Rate) (required)
Rate object.
$prop(string) (required)
Prop name.

CartShippingRateSchema::get_rate_prop() code WC 8.7.0

protected function get_rate_prop( $rate, $prop ) {
	$getter = 'get_' . $prop;
	return \is_callable( array( $rate, $getter ) ) ? $rate->$getter() : '';
}