WC_Gateway_COD::get_matching_rates()privateWC 3.4.0

Indicates whether a rate exists in an array of canonically-formatted rate IDs that activates this gateway.

Method of the class: WC_Gateway_COD{}

No Hooks.

Return

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_matching_rates( $rate_ids );
$rate_ids(array) (required)
Rate ids to check.

Changelog

Since 3.4.0 Introduced.

WC_Gateway_COD::get_matching_rates() code WC 8.7.0

private function get_matching_rates( $rate_ids ) {
	// First, match entries in 'method_id:instance_id' format. Then, match entries in 'method_id' format by stripping off the instance ID from the candidates.
	return array_unique( array_merge( array_intersect( $this->enable_for_methods, $rate_ids ), array_intersect( $this->enable_for_methods, array_unique( array_map( 'wc_get_string_before_colon', $rate_ids ) ) ) ) );
}