Automattic\WooCommerce\Admin\Features\ShippingPartnerSuggestions

DefaultShippingPartners::get_rules_for_countries()public staticWC 1.0

Get rules that match the store base location to one of the provided countries.

Метод класса: DefaultShippingPartners{}

Хуков нет.

Возвращает

Объект. Rules to match.

Использование

$result = DefaultShippingPartners::get_rules_for_countries( $countries );
$countries(массив) (обязательный)
Array of countries to match.

Код DefaultShippingPartners::get_rules_for_countries() WC 8.7.0

public static function get_rules_for_countries( $countries ) {
	$rules = array();

	foreach ( $countries as $country ) {
		$rules[] = (object) array(
			'type'      => 'base_location_country',
			'value'     => $country,
			'operation' => '=',
		);
	}

	return (object) array(
		'type'     => 'or',
		'operands' => $rules,
	);
}