Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Purchase::get_paid_theme_by_slug()privateWC 1.0

Get puchasable theme by slug.

{} Это метод класса: Purchase{}

Хуков нет.

Возвращает

Массив|null.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_paid_theme_by_slug( $slug );
$slug(строка) (обязательный)
from theme.

Код Purchase::get_paid_theme_by_slug() WC 6.4.1

private function get_paid_theme_by_slug( $slug ) {
	$themes    = Onboarding::get_themes();
	$theme_key = array_search( $slug, array_column( $themes, 'slug' ), true );
	$theme     = false !== $theme_key ? $themes[ $theme_key ] : null;
	if ( $theme && isset( $theme['id'] ) && isset( $theme['price'] ) ) {
		$price = $this->get_price_from_string( $theme['price'] );
		if ( $price && $price > 0 ) {
			return $themes[ $theme_key ];
		}
	}
	return null;
}