Automattic\WooCommerce\Internal\Admin\Suggestions\Incentives
Incentive::get_all()
Get the details of all the incentives.
The incentives are filtered based on the country code, incentive type, if provided, and their visibility.
Метод класса: Incentive{}
Хуков нет.
Возвращает
Массив
. The incentives list with details for each incentive.
Использование
$Incentive = new Incentive(); $Incentive->get_all( $country_code, $incentive_type ): array;
- $country_code(строка) (обязательный)
- The business location country code to get incentives for.
- $incentive_type(строка)
- The type of incentive to check for.
По умолчанию: ''
Код Incentive::get_all() Incentive::get all WC 9.6.1
public function get_all( string $country_code, string $incentive_type = '' ): array { $incentives = array_filter( $this->get_incentives( $country_code ), fn( $incentive ) => $this->validate_incentive( $incentive ) ); if ( ! empty( $incentive_type ) ) { $incentives = array_filter( $incentives, function ( $incentive ) use ( $incentive_type ) { return $incentive['type'] === $incentive_type; } ); } return array_values( $incentives ); }