Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions
PaymentGatewaySuggestionsDataSourcePoller::get_data_sources
Get data sources with dynamic base URL.
Метод класса: PaymentGatewaySuggestionsDataSourcePoller{}
Хуков нет.
Возвращает
Массив.
Использование
$result = PaymentGatewaySuggestionsDataSourcePoller::get_data_sources();
Код PaymentGatewaySuggestionsDataSourcePoller::get_data_sources() PaymentGatewaySuggestionsDataSourcePoller::get data sources WC 10.5.0
public static function get_data_sources() {
$data_sources = array(
WC_Helper::get_woocommerce_com_base_url() . 'wp-json/wccom/payment-gateway-suggestions/2.0/suggestions.json',
);
// Add country query param to data sources.
$base_location = wc_get_base_location();
$data_sources_with_country = array_map(
function ( $url ) use ( $base_location ) {
return add_query_arg(
'country',
$base_location['country'],
$url
);
},
$data_sources
);
return $data_sources_with_country;
}